Created
January 15, 2023 16:00
-
-
Save betomoedano/90df05d08457af3992ac5d3c8b9d0465 to your computer and use it in GitHub Desktop.
Example React Native "gap"
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 from 'react'; | |
import type {PropsWithChildren} from 'react'; | |
import {SafeAreaView, Text, ScrollView, StyleSheet, View} from 'react-native'; | |
function Row({children}: PropsWithChildren): JSX.Element { | |
return ( | |
<View | |
style={{ | |
flexDirection: 'row', | |
columnGap: 15, | |
}}> | |
{children} | |
</View> | |
); | |
} | |
function App(): JSX.Element { | |
return ( | |
<SafeAreaView style={{flex: 1}}> | |
<ScrollView contentContainerStyle={styles.container}> | |
<Text style={{fontSize: 39, fontWeight: '900'}}> | |
What's new in React Native? | |
</Text> | |
<Row> | |
<View style={styles.box} /> | |
<View style={styles.box} /> | |
<View style={styles.box} /> | |
</Row> | |
<Row> | |
<View style={styles.box} /> | |
</Row> | |
<Row> | |
<View style={styles.box} /> | |
<View style={styles.box} /> | |
</Row> | |
<Row> | |
<View style={styles.box} /> | |
</Row> | |
<Row> | |
<View style={styles.box} /> | |
<View style={styles.box} /> | |
</Row> | |
<Row> | |
<View style={styles.box} /> | |
<View style={styles.box} /> | |
<View style={styles.box} /> | |
</Row> | |
<Row> | |
<View style={styles.box} /> | |
</Row> | |
</ScrollView> | |
</SafeAreaView> | |
); | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
paddingHorizontal: 15, | |
rowGap: 15, | |
}, | |
box: { | |
flexGrow: 1, | |
height: 100, | |
borderRadius: 10, | |
backgroundColor: 'white', | |
elevation: 16, | |
shadowColor: '#000', | |
shadowRadius: 10, | |
shadowOffset: {height: 10, width: 0}, | |
shadowOpacity: 0.17, | |
}, | |
}); | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment