React Native Project Generator
This Yeoman generator sets up a new React Native project with ease.
Getting Started
-
Install Yeoman globally:
npm install -g yo
-
Install the React Native Project Generator:
npm install -g generator-rn-boilerplate
-
Create a new React Native project:
yo generator-rn-boilerplate
-
Follow the prompts to customize your project.
Customization
Changing App Name
To change the app name displayed on Android, you need to update the strings.xml
file. Follow these steps:
-
Navigate to the
android/app/src/main/res/values/
directory. -
Open the
strings.xml
file. -
Locate the following line:
<string name="app_name">MyApp</string>
-
Replace
MyApp
with your desired app name. -
Save the file.
Changing App Name in MainActivity.java
To change the app name used in the getMainComponentName
method in MainActivity.java
, follow these steps:
-
Navigate to the
android/app/src/main/java/com/yourcompanyname/yourappname/
directory. -
Open the
MainActivity.java
file. -
Locate the
getMainComponentName
method:@Override protected String getMainComponentName() { return "MyApp"; }
-
Replace
"MyApp"
with your desired app name. -
Save the file.
Building and Running
After customizing your project, you can build and run it:
-
Android:
npx react-native run-android
-
iOS:
npx react-native run-ios
Additional Information
For more information on React Native, please refer to the official documentation.
Happy coding!