re-start icon indicating copy to clipboard operation
re-start copied to clipboard

Changes in App.js is not compiling

Open lusan opened this issue 7 years ago • 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:

40ee1501bfbc2cc821bd9348d3244fa4

Expected Results:

I was expecting the code to compile.

lusan avatar Apr 08 '18 12:04 lusan

Isn't index.js used instead of App.js? They look like duplicates.

hasparus avatar Apr 10 '18 16:04 hasparus

Isn't index.js used instead of App.js? They look like duplicates.

I usually delete the one at project root, seems useless.

piranna avatar Apr 10 '18 17:04 piranna

@piranna can you suggest any solution for my issue?

lusan avatar Apr 10 '18 17:04 lusan

@piranna can you suggest any solution for my issue?

Sorry, I don't understand your problem from the description :-(

piranna avatar Apr 10 '18 19:04 piranna

@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 avatar Apr 13 '18 17:04 hasparus

@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!!

lusan avatar Apr 13 '18 18:04 lusan

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.

piranna avatar Apr 13 '18 18:04 piranna

@piranna That would be really great!

lusan avatar Apr 13 '18 19:04 lusan

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.

piranna avatar Apr 13 '18 19:04 piranna

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.

piranna avatar Apr 14 '18 18:04 piranna

@piranna sure! Looks good and will be of huge help

lusan avatar Apr 15 '18 07:04 lusan

Good you like them :-) Don't doubt to give any comment :-)

piranna avatar Apr 15 '18 17:04 piranna

A Rooter can only have one child element. Place all your Route in a View

SombrePigeon avatar Apr 16 '18 17:04 SombrePigeon

A Rooter can only have one child element. Place all your Route in a View

Could you be able to explain?

piranna avatar Apr 16 '18 19:04 piranna

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 :/

edit: The documentation that confirms what i say :)

SombrePigeon avatar Apr 16 '18 20:04 SombrePigeon

I've created an issue in React Native regarding the problems I had installing the templates from other places than the npm registry.

https://github.com/facebook/react-native/issues/18973

piranna avatar Apr 22 '18 11:04 piranna