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

SriPlatform conditionals should output the same code #14

Open
n3ziniuka5 opened this issue May 6, 2018 · 1 comment
Open

SriPlatform conditionals should output the same code #14

n3ziniuka5 opened this issue May 6, 2018 · 1 comment

Comments

@n3ziniuka5
Copy link

React-native now uses a single index.js, instead of index.android.js and index.ios.js. Conditionals like if (SriPlatform.isAndroid) produces different code for android:dev and ios:dev tasks.

This makes it hard to use a single file index.js. It should produce the same code, like when using if (ReactPlatform.OS == "android")

@virtualirfan
Copy link
Contributor

Apps created via create-react-native do indeed have only a single index.js. I felt that we had a choice to go down that route or not and so far have chosen not to. CRNA switched to a single index.js by changing the relevant ios/ and android/ code. However, we should decide to go down a path that makes sense for us. Continuing with separate files past when CRNA switched was just convenient when I was dealing with this issue.

aside: Do note that we MUST also support react-native-web going forward (working on an example project that supports all 3 targets in a single code base).

Going forward, happy to revisit. Could you enumerate the benefit of combining into a single index.js?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants