Creare FirstApp
Now we build our first App
Let's build our first React Native application on Windows as development operating system and Android as target operating system.
Now we create one simple program to display “Welcome to Tutorial Codeplay”
If you add any new style please write in StyleSheet.create({}).
React Native Code Explanation
- import React, {Component} from 'react': imports the library and other components from react module and assign then to variable React.
- const instruction: sets to display the platform-specific message.
- export default class App extends Component: defines the classes that extend the React Component. The export default class modifier makes the class "public". This block of code defines the components that represent the user interface.
- render(): a function that returns a React element.
- return(): returns the result of layout and UI components.
- View: a container that supports the layout accessibility controls. It is a fundamental component for building the UI.
- Text: a React component for displaying text.
- style: a property used for styling the components using StyleSheet.
- styles: used to design individual components.
- const styles = StyleSheet.create({}): The StyleSheet class creates the style object that controls the layout and appearance of components. It is similar to Cascading Style Sheets (CSS) used on the Web.