Using React Native Stylesheets
Creating Stylesheets:
StyleSheet.create
to define styles.import { StyleSheet } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
text: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
Applying Styles:
style
prop to apply styles to components.<View style={styles.container}>
<Text style={styles.text}>Hello, JUST-Learning!</Text>
</View>
Combining Styles:
<Text style={[styles.text, { color: 'blue' }]}>Styled Text</Text>
Best Practices:
Conclusion: Using React Native Stylesheets allows you to create organized and maintainable styles for your Expo applications. By following best practices, you can ensure your styles are reusable and efficient.