Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide example for react native #147

Closed
emmenko opened this issue Jun 19, 2015 · 25 comments
Closed

Provide example for react native #147

emmenko opened this issue Jun 19, 2015 · 25 comments
Assignees

Comments

@emmenko
Copy link
Contributor

emmenko commented Jun 19, 2015

It's not a priority, would be nice to have it though.
If someone wants to give it try feel free to start a PR :)

@johanneslumpe
Copy link
Contributor

@emmenko react-native todo mvc? I could work something out I guess

@emmenko
Copy link
Contributor Author

emmenko commented Jun 19, 2015

Sure :)

@johanneslumpe johanneslumpe self-assigned this Jun 19, 2015
@johanneslumpe
Copy link
Contributor

I suggest waiting with this, until react-native 0.6 is out, so that babel is used. I can work against the github master for know, but for the example later it might not be great to have the github master as dependency. Thoughts?

@dariocravero
Copy link
Contributor

That sounds like a good idea @johanneslumpe :)

@johanneslumpe
Copy link
Contributor

The thing is that the import does not play nice with the react-native at all (and isn't activated by default). But it might work when we prompt the user to add a .babelrc to the react-native module folder. I know, that isn't exactly the best thing but better than having to write everything without import/export. Maybe a post-install hook could be used for that?

@emmenko
Copy link
Contributor Author

emmenko commented Jun 19, 2015

As you can see in the label, it's a future idea :)

So there is no rush on this, if it's better to wait then let's wait.

@johanneslumpe
Copy link
Contributor

Yeah it's better to wait a bit longer. Over at rnplay we are spoiled, being able to always work off of master haha :D

@gaearon
Copy link
Contributor

gaearon commented Jul 7, 2015

Any blockers here?

@ms88privat
Copy link

i would love to see that example! (with hot reload and timetravel)

@gaearon
Copy link
Contributor

gaearon commented Jul 14, 2015

I'll try to release web devtools tomorrow, native devtools ASAP after that. Then I'll release RN example.

@alinz
Copy link

alinz commented Jul 17, 2015

@gaearon I have created a repo to include the react-native example. If you want me I can put it into the redux example folder.

@Dindaleon
Copy link

Great! +1 @gaearon let us know what is the official example.

@gaearon gaearon added the docs label Jul 30, 2015
@mikedizon
Copy link

@alinz could you add some documentation? looks pretty cool!

@alinz
Copy link

alinz commented Sep 1, 2015

@mikedizon I will update the example to latest stable of redux and react-native. As soon as I update the project example I will let you know.

@yonibot
Copy link

yonibot commented Sep 10, 2015

+1 looking forward to this! @alinz please keep us posted, and thanks for your work!

@alinz
Copy link

alinz commented Sep 11, 2015

@mikedizon @yonibot I have updated the example to latest of two frameworks. let me know if you need any help. React-Native 0.10 and Redux 2.0.0

enjoy :P

@chentsulin
Copy link
Contributor

One more counter example here with React-Native 0.10 and Redux 3, and only use React Native enabled transformations.

@despairblue
Copy link

@chentsulin you can enable transformers with a .babelrc file in you project root folder. No need to patch react-native. Just take the original one and add things as you please.

@chentsulin
Copy link
Contributor

@despairblue
I read the discusses in facebook/react-native#1451 and facebook/react-native#1480

It seems that now need to set resetCache option to true at node_modules/react-native/packager/packager.js to merge babel options.

@alinz
Copy link

alinz commented Sep 13, 2015

Good to know @chentsulin and thanks for your new update. I will update mine. Perhaps, we should merge our projects into one. Having multiple projects with the same goal is confusing.

What do you think?

@chentsulin
Copy link
Contributor

I think finally they will find a way to let .babelrc works without any other patches, and then we can get rid of those commonjs module stuffs, which is painful in some cases.

@despairblue
Copy link

@chentsulin
Weird, I have stock react-native installed and my .babelrc looks like this:

{
  "retainLines": true,
  "compact": true,
  "comments": false,
  "whitelist": [
    "es6.constants",
    "es6.modules",
    "es7.decorators",
    // default
    "es6.arrowFunctions",
    "es6.blockScoping",
    "es6.constants",
    "es6.classes",
    "es6.destructuring",
    "es6.parameters",
    "es6.properties.computed",
    "es6.properties.shorthand",
    "es6.spread",
    "es6.templateLiterals",
    "es7.asyncFunctions",
    "es7.trailingFunctionCommas",
    "es7.objectRestSpread",
    "es7.classProperties",
    "flow",
    "react",
    "regenerator"
  ],
  "sourceMaps": false
}

See "es7.classProperties", which is not part of the react-native's internal .babelrc. And static class properties are transformed correctly.

Maybe the issues aren't up to date?

@chentsulin
Copy link
Contributor

Babel 6 will use some different rule on .babelrc extends, and now we should just wait for it settle down.

BTW, I updated my example to support iOS and android at the same time
https://github.com/chentsulin/react-native-counter-ios-android

@despairblue
Copy link

The only problem that could come up when using a custom .babelrc, is that the react-packager might use an old cached version of a file.

This can be fixed by:

  1. stopping the packager
  2. running rm /tmp/react-packager-cache-*
  3. starting the packager again

@gaearon
Copy link
Contributor

gaearon commented Sep 24, 2015

I think we won't include an RN example in this repo so I'm closing.
Please feel free to continue sharing links to the examples.
Awesome Redux is a good place to add your examples.

@gaearon gaearon closed this as completed Sep 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests