Permalink
Browse files

Apple TV support 4: support for input (tvOS focus engine)

Reviewed By: shergin

Differential Revision: D4333546

fbshipit-source-id: 8655070e81dbb62a80ab1f00a43ef6c2d9654618
  • Loading branch information...
1 parent 2cc587f commit c92ad5f6ae74c1d398c7cd93d5c4c50da0ca0430 @javache javache committed with facebook-github-bot Dec 19, 2016
Showing with 1,012 additions and 35 deletions.
  1. BIN ...Tests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testLayoutExample_1-iOS10_tvOS.png
  2. BIN ...rationTests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testLayoutExample_1_tvOS.png
  3. BIN ...Tests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testTabBarExample_1-iOS10_tvOS.png
  4. BIN ...rationTests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testTabBarExample_1_tvOS.png
  5. BIN ...onTests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testTextExample_1-iOS10_tvOS.png
  6. BIN ...egrationTests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testTextExample_1_tvOS.png
  7. BIN ...onTests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testViewExample_1-iOS10_tvOS.png
  8. BIN ...egrationTests/ReferenceImages/Examples-UIExplorer-js-UIExplorerApp.ios/testViewExample_1_tvOS.png
  9. BIN ...ationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1_tvOS.png
  10. +1 −0 Examples/UIExplorer/UIExplorerIntegrationTests/UIExplorerIntegrationTests.m
  11. +3 −1 Examples/UIExplorer/UIExplorerIntegrationTests/UIExplorerSnapshotTests.m
  12. +3 −0 Examples/UIExplorer/UIExplorerUnitTests/RCTAllocationTests.m
  13. +7 −6 Examples/UIExplorer/js/TextExample.ios.js
  14. +3 −4 Examples/UIExplorer/js/UIExplorerExampleList.js
  15. +67 −1 Examples/UIExplorer/js/UIExplorerList.ios.js
  16. +41 −0 Libraries/Components/AppleTV/TVEventHandler.android.js
  17. +70 −0 Libraries/Components/AppleTV/TVEventHandler.ios.js
  18. +77 −0 Libraries/Components/AppleTV/TVViewPropTypes.js
  19. +25 −4 Libraries/Components/Navigation/NavigatorIOS.ios.js
  20. +8 −1 Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js
  21. +29 −1 Libraries/Components/Touchable/Touchable.js
  22. +24 −1 Libraries/Components/Touchable/TouchableHighlight.js
  23. +12 −0 Libraries/Components/Touchable/TouchableOpacity.js
  24. +4 −1 Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap
  25. +8 −0 Libraries/Components/View/View.js
  26. +29 −10 Libraries/CustomComponents/NavigationExperimental/NavigationHeader.js
  27. +22 −0 Libraries/CustomComponents/Navigator/Navigator.js
  28. +4 −0 Libraries/RCTTest/RCTTestRunner.m
  29. +10 −0 Libraries/Text/RCTTextField.m
  30. +4 −1 Libraries/Text/RCTTextViewManager.m
  31. +1 −1 Libraries/Utilities/Platform.android.js
  32. +7 −2 Libraries/Utilities/Platform.ios.js
  33. +1 −0 React/Base/RCTPlatform.m
  34. +22 −0 React/Base/RCTRootView.m
  35. +10 −0 React/Base/RCTRootViewInternal.h
  36. +16 −0 React/Base/RCTTVRemoteHandler.h
  37. +153 −0 React/Base/RCTTVRemoteHandler.m
  38. +16 −0 React/Modules/RCTTVNavigationEventEmitter.h
  39. +47 −0 React/Modules/RCTTVNavigationEventEmitter.m
  40. +32 −0 React/React.xcodeproj/project.pbxproj
  41. +33 −0 React/Views/RCTTVView.h
  42. +188 −0 React/Views/RCTTVView.m
  43. +18 −0 React/Views/RCTTabBar.m
  44. +1 −0 React/Views/RCTTabBarItemManager.m
  45. +15 −0 React/Views/RCTViewManager.m
  46. +1 −1 scripts/objc-test-tvos.sh
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -30,6 +30,7 @@ @implementation UIExplorerIntegrationTests
- (void)setUp
{
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil);
+ _runner.recordMode = NO;
}
#pragma mark - Test harness
@@ -41,12 +41,14 @@ - (void)test##name \
[_runner runTest:_cmd module:@#name]; \
}
-#if !TARGET_OS_TV // None of these will run in tvOS due to StatusBar not existing
RCT_TEST(ViewExample)
RCT_TEST(LayoutExample)
RCT_TEST(TextExample)
+#if !TARGET_OS_TV
+// No switch or slider available on tvOS
RCT_TEST(SwitchExample)
RCT_TEST(SliderExample)
+// TabBarExample on tvOS passes locally but not on Travis
RCT_TEST(TabBarExample)
#endif
@@ -213,7 +213,10 @@ - (void)testContentViewIsInvalidated
(void)rootView;
}
+#if !TARGET_OS_TV // userInteractionEnabled is true for Apple TV views
XCTAssertFalse(rootContentView.userInteractionEnabled, @"RCTContentView should have been invalidated");
+#endif
+
}
- (void)testUnderlyingBridgeIsDeallocated
@@ -22,6 +22,7 @@
*/
'use strict';
+const Platform = require('Platform');
var React = require('react');
var ReactNative = require('react-native');
var {
@@ -190,10 +191,10 @@ exports.examples = [
render: function() {
return (
<View>
- <Text style={{fontFamily: 'Cochin'}}>
+ <Text style={{fontFamily: (Platform.isTVOS ? 'Times' : 'Cochin')}}>
Cochin
</Text>
- <Text style={{fontFamily: 'Cochin', fontWeight: 'bold'}}>
+ <Text style={{fontFamily: (Platform.isTVOS ? 'Times' : 'Cochin'), fontWeight: 'bold'}}>
Cochin bold
</Text>
<Text style={{fontFamily: 'Helvetica'}}>
@@ -202,10 +203,10 @@ exports.examples = [
<Text style={{fontFamily: 'Helvetica', fontWeight: 'bold'}}>
Helvetica bold
</Text>
- <Text style={{fontFamily: 'Verdana'}}>
+ <Text style={{fontFamily: (Platform.isTVOS ? 'Courier' : 'Verdana')}}>
Verdana
</Text>
- <Text style={{fontFamily: 'Verdana', fontWeight: 'bold'}}>
+ <Text style={{fontFamily: (Platform.isTVOS ? 'Courier' : 'Verdana'), fontWeight: 'bold'}}>
Verdana bold
</Text>
</View>
@@ -565,10 +566,10 @@ exports.examples = [
<Text style={{fontVariant: ['small-caps']}}>
Small Caps{'\n'}
</Text>
- <Text style={{fontFamily: 'Hoefler Text', fontVariant: ['oldstyle-nums']}}>
+ <Text style={{fontFamily: (Platform.isTVOS ? 'Times' : 'Hoefler Text'), fontVariant: ['oldstyle-nums']}}>
Old Style nums 0123456789{'\n'}
</Text>
- <Text style={{fontFamily: 'Hoefler Text', fontVariant: ['lining-nums']}}>
+ <Text style={{fontFamily: (Platform.isTVOS ? 'Times' : 'Hoefler Text'), fontVariant: ['lining-nums']}}>
Lining nums 0123456789{'\n'}
</Text>
<Text style={{fontVariant: ['tabular-nums']}}>
@@ -23,23 +23,22 @@
'use strict';
const ListView = require('ListView');
+const Platform = require('Platform');
const React = require('react');
const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TextInput = require('TextInput');
const TouchableHighlight = require('TouchableHighlight');
-const View = require('View');
const UIExplorerActions = require('./UIExplorerActions');
const UIExplorerStatePersister = require('./UIExplorerStatePersister');
+const View = require('View');
import type {
UIExplorerExample,
} from './UIExplorerList.ios';
-
import type {
PassProps,
} from './UIExplorerStatePersister';
-
import type {
StyleObj,
} from 'StyleSheetTypes';
@@ -66,7 +65,7 @@ class UIExplorerExampleList extends React.Component {
render(): ?React.Element<any> {
const filterText = this.props.persister.state.filter;
const filterRegex = new RegExp(String(filterText), 'i');
- const filter = (example) => filterRegex.test(example.module.title);
+ const filter = (example) => filterRegex.test(example.module.title) && (!Platform.isTVOS || example.supportsTVOS);
const dataSource = ds.cloneWithRowsAndSections({
components: this.props.list.ComponentExamples.filter(filter),
Oops, something went wrong.

0 comments on commit c92ad5f

Please sign in to comment.