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

improve documentation of how to install this or other fork of React Native #49

Closed
brodycj opened this issue Mar 1, 2020 · 7 comments
Closed

Comments

@brodycj
Copy link

brodycj commented Mar 1, 2020

I think I finally understand it today, while working on something else, how installing from this fork works.

@dlowder-salesforce already described it in brodycj/create-react-native-module#95 (comment) for a custom native module but I think something similar is needed for an existing or new React Native app for tvOS. I think it should be this in case of Yarn (highly recommended):

yarn add react-native@npm:react-native-tvos

or for a specific version or tag name (I am showing for inexact version number, which should work in theory at least):

yarn add react-native@npm:[email protected]

At this point the README.md shows how to do this by editing package.json, which I would generally not recommend when using frameworks like this one.

related to:

I would love to contribute sometime, unfortunately cannot promise due to some other priorities right now.

@asgvard
Copy link

asgvard commented Mar 27, 2020

Hi!
Subscribed to this thread. Would be interesting to see about how it is possible to use this repo for tvOS, but still have RN core repo for other targets.
I.e. if we develop an app that needs to support multiple platforms like web, AndroidTV and tvOS, then changing package.json is not a good options since all the other platforms will refer to "react-native-tvos" which might bring some implications.
Is there another option to alias to this library only for tvOS platform, but still keep using core RN for other platforms?

@brodycj
Copy link
Author

brodycj commented Apr 8, 2020

I think it should be this in case of Yarn (highly recommended):

yarn add react-native@npm:react-native-tvos

I read today in #11 (comment) that this would only work with Yarn, not with npm (Yarn seem to work much better with React Native projects anyway).

or for a specific version or tag name (I am showing for inexact version number, which should work in theory at least):

yarn add react-native@npm:[email protected]

That version pattern does not seem to work, perhaps because there was always 0.60.4-* tags. I tried a couple more:

  • react-native init testing --version react-native@npm:react-native-tvos@^0.60.0-0 - no go
  • react-native init testing2 --version react-native@npm:react-native-tvos@^0.60.4-0 - voila

I do hope we can improve the situation with the 0.x version pattern at some point.

Is there another option to alias to this library only for tvOS platform, but still keep using core RN for other platforms?

I would unfortunately doubt that idea, since a React Native project normally expects some form of a single react-native dependency that it can build from.

I think the discussion in #11 explains why we are stuck with supporting tvOS in a fork like this one. While I do still think it would be ideal to build for tvOS as on out-of-tree platform, in a similar fashion to react-native-windows and react-native-turbolinks, and reusing as much iOS native implementation as possible from react-native, I think this would be a very if not extremely challenging task not likely work the trouble.

@douglowder
Copy link
Collaborator

@brodybits is correct that you should have only a single react-native dependency in your project. This repo supports tvOS AND all the other platforms already supported by RN core.

All releases of this repo have versions of the form 0.xx.x-z, where the x digits come from the base RN core version, and we add a tvOS version number at the end after the dash. This helps make it clear which RN core version forms the basis for a release.

I will add some text in README.md to try to clarify these issues, and also show how to init a new project using both the older react-native-cli and the newer @react-native-community/cli.

@douglowder
Copy link
Collaborator

#63 is merged, and appears in https://github.com/react-native-community/react-native-tvos/releases/tag/v0.61.5-1 and in the README for the public npm package. Closing.

@brodycj
Copy link
Author

brodycj commented May 3, 2020

There is still something not clear to me: how to use previous react-native-tvos 0.x version such as 0.60.x-x or 0.61.x-x by inexact version number. Of course I could just look it up on npmjs.com to find 0.60.4-6 or 0.61.5-1 for example, but I would rather be able to specify a more general pattern. This is analogous to using [email protected] or [email protected].

While I do think it is generally best practice to use the latest version, I think this should not be forced or coerced too strongly. I generally like to test my create-react-native-module tool on React Native versions back to 0.60, for example. I would be happy to raise this question in a new issue, if needed.

A side point, possibly off-topic, is that React Native 0.62 seems to take much longer to build and run on iOS. I should probably raise this in react-native-community. Maybe I just have to upgrade, unfortunately cannot afford it right now.

I would like to give thanks again for this really nice fork with the TV support.

@douglowder
Copy link
Collaborator

@brodybits:

There is still something not clear to me: how to use previous react-native-tvos 0.x version such as 0.60.x-x or 0.61.x-x by inexact version number. Of course I could just look it up on npmjs.com to find 0.60.4-6 or 0.61.5-1 for example, but I would rather be able to specify a more general pattern. This is analogous to using [email protected] or [email protected].

I'll have a look at how RN core does this -- I think this might be something done in npm publish.

A side point, possibly off-topic, is that React Native 0.62 seems to take much longer to build and run on iOS. I should probably raise this in react-native-community. Maybe I just have to upgrade, unfortunately cannot afford it right now.

Did you take out the Flipper pods?

I would like to give thanks again for this really nice fork with the TV support.

I appreciate the kind words :)

@brodycj
Copy link
Author

brodycj commented May 5, 2020

This is analogous to using [email protected] or [email protected].

I'll have a look at how RN core does this -- I think this might be something done in npm publish.

I suspect that it just works with npm semver because RN core generally publishes with no dashed suffix. The following commands seem to approximate what I was trying to do:

  • react-native init testapp --version react-native@npm:react-native-tvos@^0.60.4-0
  • react-native init testapp --version react-native@npm:react-native-tvos@^0.61.5-0

I am now starting to wonder how much effort it is really work testing with the old versions. I just took a look at the active branches, just looking at it was a little painful.

Did you take out the Flipper pods?

Taking out the Flipper pods sure speeds up my build. Here is what I did in case it may help any others updated:

  • commented out both add_flipper_pods! lines in ios/Podfile
  • used Yarn to add a custom native module that I am working on
  • ran pod install within the ios subdirectory
  • replace demo/AppDelegate.m with AppDelegate.m from a slightly earlier version of React Native such as 0.60 or 0.61, which does not use Flipper (alt: replace #if DEBUG with #if 0 in 2 places in demo/AppDelegate.m to stop it from using Flipper)
  • did yarn start in a terminal tab where I can easily view and control Metro
  • did standard react-native run-ios to run on iOS
  • did open ios/demo.xcworkspace to open in Xcode where I can then run on tvOS

This issue helped me figure it out: facebook/flipper#976

I think it would be nice if this could be documented and supported a little more formally by React Native itself.

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

3 participants