question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why tvOS is a fork and not a module?

See original GitHub issue

updated:

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:closed
  • Created 4 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
douglowdercommented, Sep 10, 2019

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:

  • Preprocessor directives in common Objective-C files to stub out code that won’t compile on tvOS
  • Xcode project changes (or podspec additions) to exclude iOS-only features (like sliders and switches) from tvOS targets
  • tvOS-only files to implement basic functionality (RCTTVView, RCTTVEventHandler, etc.)
  • tvOS-only files to implement special features needed for some apps (RCTTVFocusGuideView, etc.)

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.

2reactions
douglowdercommented, Sep 16, 2019

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 for react-native:

  "react-native": "npm:react-native-tvos"

This is not supported by npm install, but is supported by yarn. I recommend using yarn over npm 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-tvos - npm
A framework for building native apps using React. Latest version: 0.69.6-0, last published: a month ago. Start using react-native-tvos in ...
Read more >
tvOS build considerations - Unity - Manual
Unity routes Apple TV Remote input to corresponding Unity APIs, but performs no other processing on that input.
Read more >
create-react-native-module - npm package - Snyk
Learn more about create-react-native-module: package health score, popularity, ... requires the react-native-tvos fork, with minimum version of 0.60 ref:.
Read more >
How to replace or resolve __TVOS_P… - Apple Developer
When I compile this code for iOS and run it under tvOS then it works. ... there a dummy fork() function so it...
Read more >
Command mergeswiftmodule failed with a nonzero exit code
0, but module 'xxxTests' has a minimum deployment target of iOS 14. ... code” “Resource fork, Finder information, or similar detritus not allowed”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found