Changes in App.js is not compiling
lusan opened this issue · 16 comments
- template name : re-start
- template version : (0.x.x)
- react-native version: 0.54.2
- OS : osX
- Platform causing error: (android/ios/web/electron)
Any change I make in the App.js file, it does not compile at all, hence I am unable to add new route.
Please help, or am I doing something wrong?
Observed Results:
Expected Results:
I was expecting the code to compile.
Isn't index.js used instead of App.js? They look like duplicates.
Isn't index.js used instead of App.js? They look like duplicates.
I usually delete the one at project root, seems useless.
@piranna can you suggest any solution for my issue?
Sorry, I don't understand your problem from the description :-(
@lusan Okay, from the gif you posted I see you're running web dev server. /App.js is an entry point for native apps and /src/index.js is the same for the web version. It's not your fault, don't worry. IMO we shouldn't specify routes in more than one place. Current solution is far from DRY 💧.
Just linked my PR with code that can help you, @lusan.
@hasparus Oh Geez! It was 3am when I was sleepily trying, I was so obsessed with building it, forgot to notice this, thank you so much!!
I'm working on a full clean-up of the project at https://github.com/piranna/re-start, hope I can be able to make it run today.
So far first step done, get to install it. I've only been able to do it by publishing the template on npm, it doesn't work by using local filesystem or scoped packages due to a bug in react-native
CLI at https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/local-cli/generator/templates.js#L115. Now it's time to finish to fix and tune-up it, and later do a pull-request so @amoghbanta can be able to publish it in npm so I can be able to remove my package and don't pollute npm
registry anymore.
I have finished the pull-request with my refactor if you want to take a look on it. Also, the react-native-template-re-base_piranna host a valid re-base
template now, only that take in account that was done just for testing purposses and if @amoghbanta merge and publish my changes it should be removed, so don't confide on it more than just for testing a comments.
Next steps, include tests that the templates generate working projects that run on all the platforms, and integrate it with GreenKeeper and TravisCI to have the dependencies updated.
Good you like them :-) Don't doubt to give any comment :-)
A Rooter can only have one child element.
Place all your Route in a View
A Rooter can only have one child element.
Place all your Route in a View
Could you be able to explain?
The message that i got in the js console when i had the same problem said this.
So if i remember well, the following code :
<Router>
<View>
<Route .../>
<Route .../>
</View>
</Router>
should works.
Not this one :
<Router>
<Route .../>
<Route .../>
</Router>
I can just say that his is just how react router works :/
I've created an issue in React Native regarding the problems I had installing the templates from other places than the npm
registry.