-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
Combine separate *.{android,ios}.js files #3018
Comments
This was referenced Oct 2, 2018
I'll take on the |
jainkuniya
added a commit
to jainkuniya/zulip-mobile
that referenced
this issue
Oct 3, 2018
No logical change, just code refactor. Part of zulip#3018
jainkuniya
added a commit
to jainkuniya/zulip-mobile
that referenced
this issue
Oct 3, 2018
No logical change, just code refactor. Refer zulip#3018 to know the motivation behind this. Create mock `DocumentDir` method for `react-native-fetch-blob` to pass jest test cases (wkh237/react-native-fetch-blob#383).
This was referenced Oct 3, 2018
borisyankov
added a commit
to borisyankov/zulip-mobile
that referenced
this issue
Oct 5, 2018
Part of zulip#3018 Merge the platform specific-files of `downloadFile` into one file that manually checks for the appropriate version.
gnprice
pushed a commit
to jainkuniya/zulip-mobile
that referenced
this issue
Oct 11, 2018
No logical change, just code refactor. Part of zulip#3018
gnprice
pushed a commit
that referenced
this issue
Oct 11, 2018
No logical change, just code refactor. Refer #3018 to know the motivation behind this. Create mock `DocumentDir` method for `react-native-fetch-blob` to pass jest test cases (wkh237/react-native-fetch-blob#383).
gnprice
added a commit
that referenced
this issue
Apr 4, 2019
One of the few remaining examples of #3018. Note that it's definitely fine to import unconditionally from `react-native-safari-view` on Android... because our `utils/openLink` already does, and in fact does so in order to provide the exact same functionality as one of these functions. :-) So this illustrates again how the .ios.js / .android.js split can hide opportunities to share logic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have 8 pairs of files named
foo.ios.js
/foo.android.js
. These make use of an RN feature where when building for each platform, only the one file is included.We should stop using this feature. As I explained here a little while ago, there are a couple of quite concrete costs to it, and the fact that it's a problem fits a classic pattern:
Instead, we should just use plain JS conditionals.
What's involved in doing so? Here are the 8 such pairs we have:
So 7 are very short. These, we should just straightforwardly combine. See
dd7cf10 for an example a little longer than any of those 7, or d0b1317 for a more complex example.
The one not-short example is ComposeBox. That'll be more work, and blocked behind some other work which we're actively pursuing; it's tracked separately, as #3017. (This one is an example where conditionals would have been less appealing... though if we didn't expect to get rid of one version soon, it'd make sense to do some refactoring to make conditionals work well there too.)
The text was updated successfully, but these errors were encountered: