Created
September 16, 2020 13:40
-
-
Save thibaut-d/c44af2bc11afe6723817b0fa69c1756b to your computer and use it in GitHub Desktop.
Basic functional component for React Native with TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react' | |
import { StyleSheet, Text, View } from 'react-native' | |
interface Props { | |
/** prop1 documentation */ | |
prop1: string | |
} | |
/** | |
* Component description | |
* | |
* @param props - {@link Props} | |
*/ | |
const ComponentName: FC<Props> = ({ prop1 }: Props) => { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.inContainer}>Work in progress {prop1}</Text> | |
</View> | |
) | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, // full space | |
flexDirection: 'row', // elements disposition | |
justifyContent: 'center', // following flexDirection | |
alignItems: 'center', // perpendicular to flexDirection | |
}, | |
inContainer: { | |
alignSelf: 'center', // following flex direction | |
}, | |
}) | |
export default ComponentName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment