react-everywhere / re-start

react-native template to target multiple platforms :globe_with_meridians: :iphone: :computer: with single codebase.
https://medium.com/@amoghbanta/write-once-use-everywhere-with-react-native-d6e575efe58e#.nfl50gwfg
MIT License
1.3k stars 85 forks source link

Changes in App.js is not compiling #58

Open lusan opened 6 years ago

lusan commented 6 years ago

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.

hasparus commented 6 years ago

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

piranna commented 6 years ago

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

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

lusan commented 6 years ago

@piranna can you suggest any solution for my issue?

piranna commented 6 years ago

@piranna can you suggest any solution for my issue?

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

hasparus commented 6 years ago

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

lusan commented 6 years ago

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

piranna commented 6 years ago

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.

lusan commented 6 years ago

@piranna That would be really great!

piranna commented 6 years ago

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 commented 6 years ago

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.

lusan commented 6 years ago

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

piranna commented 6 years ago

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

SombrePigeon commented 6 years ago

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

piranna commented 6 years ago

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

Could you be able to explain?

SombrePigeon commented 6 years ago

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

piranna commented 6 years ago

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