diff options
Diffstat (limited to 'src/components/common/CenteredView.tsx')
-rw-r--r-- | src/components/common/CenteredView.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/components/common/CenteredView.tsx b/src/components/common/CenteredView.tsx new file mode 100644 index 00000000..1c5ed399 --- /dev/null +++ b/src/components/common/CenteredView.tsx @@ -0,0 +1,25 @@ +import React from 'react'; +import {View, StyleSheet, ViewProps} from 'react-native'; + +interface CenteredViewProps extends ViewProps {} +/** + * A centered view that grows to its parents size. + * @param children - children of this component. + */ +const CenteredView: React.FC<CenteredViewProps> = (props) => { + return ( + <View style={styles.centeredView} {...props}> + {props.children} + </View> + ); +}; + +const styles = StyleSheet.create({ + centeredView: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + }, +}); + +export default CenteredView; |