Why tvOS is a fork and not a module?
See original GitHub issueupdated:
Summary: see title which was updated several times, by multiple people, and is now a question.
Resolution: see below - agreed on my part
Original rationale:
I did not realize until after I merged brodybits/create-react-native-module#91 that tvOS was actually moved into its own package separate from the core react-native package. I then raised facebook/react-native-website#1250 to add this to the documents.
original idea now withdrawn on my part:
But I am now wondering if we could find a way to improve on a couple things.
It seems to me that this repo is a full-blown fork of react-native. I think it would be been nicer if react-native-tvos would use react-native as a dependency, and reuse as much as possible, in a similar fashion to react-native-windows, react-native-dom, and react-native-turbolinks.
I can think of the following reasons:
- support combination with other platforms such as Windows, DOM, and possibly macOS more cleanly
- applications and native modules can always use react-native from the standard place
- enable applications and native modules to use react-native patch updates
(I would also like to see a similar idea applied for react-native-macos.)
more details withdrawn on my part
I think this would be a breaking change that should target an upcoming react-native release, perhaps 0.61.
Unfortunately I don’t have so much time to look into this idea right now, hope I can take a look someday.
an old update now withdrawn on my part
P.S. I now think that tvOS should be built from its own `tvos` subdirectory, see my response below.Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (1 by maintainers)
The key difference between tvOS support in React Native, versus other out of tree platforms like Windows and web, is that tvOS shares almost all its native code with iOS. The tvOS-specific native code can be generally divided into these types:
Ideally, the core repo would have all the first three types of changes, and
react-native-tvos
could be a module that adds the special TV add-on features. However, the core team does not want to support tvOS there any more, and can’t guarantee that the core repo will not be broken on tvOS at any given time.(When I originally merged the tvOS changes, I added tvOS testing to the CI scripts run in open source; however, at the time, FB had a process that routinely merged changes only after running their own internal CI that didn’t include tvOS.)
I could provide a tvOS module that would apply a giant patch to all the iOS files in core, but that would be a VERY large patch, probably very brittle to small changes in core, etc., etc.
So the best option I can see at the moment is running a fork, where I release versions based on specific core releases. The release notes for each tvOS version show exactly the commits applied on top of the base core release.
I just tested this with a new app generated with
react-native init
.I think the problem you are seeing is in the
package.json
alias dependency forreact-native
:This is not supported by
npm install
, but is supported byyarn
. I recommend usingyarn
overnpm
anyway – it’s generally faster.If you are still seeing this problem, then (as @brodybits suggested above) please create a new issue with a minimal set of repro steps.