brodycj / create-react-native-module

MIT License
664 stars 52 forks source link

some tvOS platform followup tasks #95

Open brodycj opened 5 years ago

brodycj commented 5 years ago

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

with potentially controversial TODO items from @brodybits:

/cc @dlowder-salesforce

douglowder commented 5 years ago

Awesome! Please assign this to me :)

brodycj commented 5 years ago

Thanks, assigned to you as a bug now

brodycj commented 5 years ago

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.

douglowder commented 5 years ago

[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

douglowder commented 5 years ago

[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

douglowder commented 5 years ago

[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:

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

brodycj commented 5 years ago

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.

brodycj commented 5 years ago

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!

douglowder commented 5 years ago

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