Sunday, June 21, 2020

React Native First simple app 2021

Steps to create react native application:

1. Open the "Command Prompt" , then select directory in which you create your project ,then type following commands,
  • npm install -g create-react-native-app
  • npm install -g react-native-cli
  • react-native init FirstApp
2. Then go to the VScode & open the project, also open this project in android studio. Then in VScode terminal run the command : react-native run-android. it will start node server and launch your app in virtual device emulator or connect mobile n run on that.

3. If you open the default app you can observe that the app.js file looks like
_____________________________________________________
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
   render() {
      return (
         <View style = {styles.container}>
            <Text>Open up App.js to start working on your app!</Text>
            <Text>Changes you make will automatically reload.</Text>
            <Text>Shake your phone to open the developer menu.</Text>
         </View>
      );
   }
}

const styles = StyleSheet.create({
   container: {
      flex: 1,
      backgroundColor: '#fff',
      alignItems: 'center',
      justifyContent: 'center',
   },
});
__________________________________________________________________________________

Output:




Create a simple "Hello World" app by editing App.js file of FirstApp.

Save the application and reload by simply pressing twice "R" or Ctrl+M (Reload).

______________________________________________________

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
   render() {
      return (
         <View>
            <Text>This is my firstapp</Text>
         </View>
      );
   }
}

__________________________________________________________________________________

Previous Post
Next Post

post written by:

Hello guys, myself Pooja Tirmare. I want to share my knowledge with people so they can learn react native and make beautiful applications.