If you do something like:
react-native init my-native-app
React will create a project scaffold for you but the resulting javascript file will fail to load.
So you will get something like:
var my-native-app = React.createClass({
In your index.ios.js file.
Not a huge problem but it should probably remove hyphens the hyphens non the less.
I did the exact same thing. :monkey:
ah, good point!
This is weird, why couldn't the hyphens be removed and the thing kebab-cased where it needed to be? Even if I change the project name in package.json to use hyphens after creation then the upgrade command fails, but hyphen is a convention for package names on NPM.. such as react-native :D
I'm very inclined to agree with @DominicTobias on this one - it's very frustrating to have just the react-native projects named inconsistently to the rest of an NPM package set and runs contrary to the norms of the ecosystem.
@amasad: Is there any scope to re-open this issue or has the react-native team decided that this is a matter of policy/won't fix? I'm happy to knock together a PR for this, as there's only a finite number of places this occurs. What I'd propose to do is:
Can do this sometime this week?
Here's a workaround that I've tried and tested.
react-native init projectNameHereprojectNameHere directory to project-name-herename in package.json to project-name-herereact-native run-android still works.If I'm missing a reason this won't work, please do let me know.
react-native upgrade will fail if you change the project name from camelCase to kabob-case. So while you can run the project this way, you're stuck there without additional workarounds.
Most helpful comment
Here's a workaround that I've tried and tested.
react-native init projectNameHereprojectNameHeredirectory toproject-name-herenameinpackage.jsontoproject-name-herereact-native run-androidstill works.If I'm missing a reason this won't work, please do let me know.