React Native Sample Project

Terminal > npx react-native init ReactNativeSample

1.Open the Terminal

2.In the terminal -> enter the path which you want to save the project folder as shown in the following figure.

3.Enter the command as mentioned in terminal> npx react-native init ReactNativeSample

4.Now Project folder successfully created as we mentioned Terminal path.

create new react native project in terminal

App.js

1.Open the Project Folder using IDE (Ex: Visual studio code)

2.In the visual studio code -> The Project folder is displayed as shown in the following figure.

3.Observe the project folder _tests_ ,android, ios , node_modules , app.js are created in this project folder

4.Double click the app.js , will give us option add or edit the existing the app.js

/**
* Sample React Native App
*
*/
import React from 'react';
import {
StyleSheet,
View,
Text,
StatusBar,
} from 'react-native';


const App = () => {
return (
<StatusBar barStyle="dark-content"/>
<View style={styles.body}>
<Text>Hello, world!</Text>
</View>
);
};

const styles = StyleSheet.create({
body: {
flex: 1, justifyContent: "center", alignItems: "center"
},
});
			
export default App;

Run Command for Android & IOS

1.Open the Terminal

run the android application in terminal-> cd "/Users/ramasamy/Desktop/ReactNativeSample" && npx react-native run-android

run the ios application in terminal-> cd "/Users/ramasamy/Desktop/ReactNativeSample" && npx react-native run-ios

run react native project in terminal
cd "/Users/ramasamy/Desktop/ReactNativeSample" && npx react-native run-android

1.Open the Terminal

2.Right click the android folder as shown below figure

cd "/Users/ramasamy/Desktop/ReactNativeSample" && npx react-native run-ios

1.Open the Terminal

2.Right click the ios as shown below figure

Output Result

Once enter the command , after a minute , the result will be displayed simulator / emulator in the following figure

Ramasamy

I started to learn android and Kotlin and iOS and Hybrid application and i love more interesting to code and finding new developer minds who are join to me You're welcome to keep on using my website.Instead, you can join our FB page for developer comments and post there: https://www.facebook.com/ramasamy.m.779 Best wishes :) Ramasamy(Software Developer)

Android Development and IOS Development & React Native Application

See what's new in Android & IOS & Hybrid development … explore and learn in site

About Ramasamy

Kotlin and React native example too

Related Posts

Leave a message