- Create Components folder under src folder
- Add TextEXP.js file and add below Code
import React from "react";
import { Text, View, StyleSheet } from "react-native";
const StylingEXP1 = () => {
return (
<View>
<Text>Styling example</Text>
<Text style={styles.myStyle}>Line 1</Text>
<Text>Line 2</Text>
<Text>Line 2</Text>
</View>
);
};
export default StylingEXP1;
const styles = StyleSheet.create({
myStyle: {
marginTop: 20,
textAlign: "center",
color: "blue",
fontWeight: "bold",
fontSize: 20
}
});
- Open App.js file and update code as below
import React from 'react';
import { View,StyleSheet } from 'react-native';
import StylingEXP1 from './src/Component/StylingEXP1'
const App=()=> {
return (
<View style={styles.container}>
<StylingEXP1/>
</View>
);
}
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
paddingTop:80
},
});
No comments:
Post a Comment