Showing posts with label Root view. Show all posts
Showing posts with label Root view. Show all posts

10 February 2020

Root view back ground color set example in react native

  • Create Components folder under src folder
  • Add TextEXP.js file and add below Code
import React from "react";
import { TextViewStyleSheet } from "react-native";

const RootViewBackgroundColorSet = () => {
  return (
    <View>
      <Text>View Background Color example </Text>
      <Text>Line 1</Text>
      <Text>Line 2</Text>
      <Text>Line 2</Text>
    </View>
  );
};
export default RootViewBackgroundColorSet;
  • Open App.js file and update code as below
import React from 'react';
import { View,StyleSheet } from 'react-native';
import RootViewBackgroundColorSet from './src/Component/RootViewBackgroundColorSet'

 const  App=()=> {
  return (
    <View style={styles.container}>
      <RootViewBackgroundColorSet/>
    </View>
  );
}
export default App;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#FF0000",
    alignItems: 'center',
    paddingTop:80
  },
});


Output: