Provash
Provash

Reputation: 2002

How to add space in react native application name?

How can I add a space in my application name? Such as, if I do

react-native init HelloWorld

it would create an application with name HelloWorld. But if I do this

$ react-native init "Hello World"  
"Hello World" is not a valid name for a project.
Please use a valid identifier name (alphanumeric).

Is there any way to add space in the project name? I found a solution for iOS (https://github.com/facebook/react-native/issues/6115), but I'm developing for android. Please let me know how can I solve this problem.

Upvotes: 19

Views: 17490

Answers (2)

Asif vora
Asif vora

Reputation: 3359

Add this key in info.plist

<key>CFBundleDisplayName</key> 
<string>Top&#x2007;Articles</string>

Remember &#x2007; not worked in build setting of the project.&#x2007; this will work as space

Output:
Top Articles

Upvotes: 11

atlanteh
atlanteh

Reputation: 5835

Your projects in react-native can't have spaces in them, but you can change the app name directly in the android & ios projects.

For android:
go to android/app/src/main/res/values/string.xml and change app_name to your desired value.

For ios:
Go to ios/[currentName].xcodeproj/project.pbxproj and change the PRODUCT_NAME values, both in debug and release, from the current name to your new name.

or go to ios/[currentName]/info.plist, find this:

<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>

and replace the ${PRODUCT_NAME} with your desired name

Upvotes: 33

Related Questions