brodybits / create-react-native-module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

some tvOS platform followup tasks

brodybits opened this issue · comments

followup to tvOS platform support added in PR #91, with some TODO items:

  • add a quick pointer to the documentation - done by @brodybits
  • test and document how to create a module with a working example on tvOS
    (@brodybits could use some pointers on this)
  • test and document tvOS support on React Native 0.59 vs 0.60 (I would like to keep both since React Native 0.59 is still needed for Expo and the partially supported Windows platform)
    (as discussed below, it looks like supporting tvOS on RN 0.59 may not really be desired)
  • test and document how to create a view module (using the --view option) with a working example on tvOS
  • gain and document a better understanding of motivation for supporting the tvOS platform
  • resolve issue with tvOS and Android in react-native-tvos/react-native-tvos#7
  • test usage with Android and document any possible quirks or workarounds needed
  • improve the documentation
  • fix doc on react-native-website - facebook/react-native-website#1279
  • consider a more general approach for out-of-tree platforms

with potentially controversial TODO items from @brodybits:

  • make tvOS platform support optional, not enabled by default (PR #126)
  • I think the tvOS platform build should be done from its own tvos subdirectory and not ios (see my thoughts in #122 for some more details)

/cc @dlowder-salesforce

Awesome! Please assign this to me :)

Thanks, assigned to you as a bug now

For the generated example, there is already a --example-react-native-version option that should be able to specify fork and version to use React Native from. In case this is not enough to support tvOS, I think we should try to fix the existing option if possible.

[x] test and document how to create a module with a working example on tvOS

Creating a bare bones module for tvOS:

# use latest version
create-react-native-module tv-test --generate-example --example-name TvTest --example-react-native-version react-native@npm:react-native-tvos
# use a specific version number
create-react-native-module tv-test --generate-example --example-name TvTest --example-react-native-version react-native@npm:react-native-tvos@0.60.4-3
# Cocoapods
cd react-native-tv-test/TvTest/ios
pod install
# Open the workspace
open TvTest.xcworkspace

At the top bar of the project window, select the TvTest-tvOS target and one of the available Apple TV simulators:

Screen Shot 2019-09-10 at 12 53 49 PM

Then build and run, and you should see the example screen on the Apple TV simulator:

Simulator Screen Shot - Apple TV - 2019-09-10 at 12 57 25

[x] test and document how to create a view module (using the --view option) with a working example on tvOS

Creating a view module:

Same steps as above, but pass in the --view parameter.

create-react-native-module tv-view-test --view --generate-example --example-name TvViewTest --example-react-native-version react-native@npm:react-native-tvos

Resulting screen shot:

Simulator Screen Shot - Apple TV - 2019-09-10 at 15 41 15

[x] test and document tvOS support on React Native 0.59 vs 0.60 (I would like to keep both since React Native 0.59 is still needed for Expo and the partially supported Windows platform)

Support for tvOS in 0.59 for this tool will require some work:

  • There is no tvOS target in the generated Xcode project file for a module created with this tool
  • There seem to be compilation issues for iOS in react-native init - generated projects with react-native-tvos@0.59 (although tvOS compiles fine)

Since tvOS is not supported by expo, I think it's probably fine to only support 0.60.x and higher.

Thanks @dlowder-salesforce, I hope to try it out soon (no promises right now). One more question is if you can explain the motivation for supporting tvOS.

The one thing about supporting tvOS is that it becomes one more thing for us to test and avoid breaking anytime we make a significant change that affects iOS.

In comparison, I do hope to include support for macOS someday (tracked in #94), while I would love to drop Windows support as discussed in #43.

Hey @dlowder-salesforce, I just got both the bare bones module and the view module working on tvOS (simulator) according to your directions. Looks like a nice presentation tool!

The Apple TV is indeed a nice presentation tool -- in fact I have a talk that is itself a RN app for tvOS. Here I am presenting it on a real TV device (this is last year so some of the content is out of date). https://www.youtube.com/watch?v=zrYiQr6CBg8