From 216037757494edf990ecb5a3dfdf6f75bab818a1 Mon Sep 17 00:00:00 2001 From: simek Date: Mon, 28 Sep 2020 21:24:45 -0700 Subject: [PATCH] remove most of tvOS remnants from the code (#29407) Summary: Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743, https://github.com/facebook/react-native/issues/29018 This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code. In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now. ## Changelog * **[Internal] [Removed]** - remove most of tvOS remnants from the code: * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter` * **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages * **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method * **[iOS] [Removed]** - remove deprecated and TV related props from View: * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties` * **[iOS] [Removed]** - remove `BackHandler` utility implementation Pull Request resolved: https://github.com/facebook/react-native/pull/29407 Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required. Reviewed By: PeteTheHeat Differential Revision: D22619441 Pulled By: shergin fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6 --- .../Dockerfiles/scripts/run-ci-e2e-tests.sh | 5 - .../React-RCTActionSheet.podspec | 4 +- Libraries/Blob/React-RCTBlob.podspec | 2 +- .../Components/AppleTV/TVEventHandler.js | 51 ---- Libraries/Components/ScrollView/ScrollView.js | 3 +- Libraries/Components/Touchable/TVTouchable.js | 55 ---- Libraries/Components/Touchable/Touchable.js | 22 -- .../Components/Touchable/TouchableBounce.js | 31 --- .../Touchable/TouchableHighlight.js | 27 -- .../Touchable/TouchableNativeFeedback.js | 31 --- .../Components/Touchable/TouchableOpacity.js | 31 --- .../Touchable/TouchableWithoutFeedback.js | 31 --- .../DeprecatedTVViewPropTypes.js | 23 -- Libraries/FBLazyVector/FBLazyVector.podspec | 2 +- .../FBReactNativeSpec.podspec | 2 +- Libraries/Image/React-RCTImage.podspec | 2 +- Libraries/LinkingIOS/React-RCTLinking.podspec | 2 +- .../React-RCTAnimation.podspec | 2 +- Libraries/Network/React-RCTNetwork.podspec | 2 +- .../RCTPushNotificationManager.h | 2 +- .../RCTPushNotificationManager.mm | 14 +- .../React-RCTPushNotification.podspec | 2 +- Libraries/RCTRequired/RCTRequired.podspec | 2 +- Libraries/Settings/React-RCTSettings.podspec | 2 +- Libraries/Text/React-RCTText.podspec | 2 +- Libraries/Text/Text/RCTTextView.m | 4 +- .../RCTMultilineTextInputViewManager.m | 2 - .../Text/TextInput/Multiline/RCTUITextView.m | 2 - .../Text/TextInput/RCTBaseTextInputView.m | 8 +- .../TextInput/RCTInputAccessoryViewContent.m | 2 +- Libraries/TypeSafety/RCTTypeSafety.podspec | 2 +- Libraries/Utilities/BackHandler.android.js | 7 +- Libraries/Utilities/BackHandler.ios.js | 107 +------- .../Vibration/React-RCTVibration.podspec | 2 +- React-Core.podspec | 9 +- React.podspec | 2 +- React/Base/RCTConvert.m | 5 - React/Base/RCTRootView.m | 22 -- React/Base/RCTRootViewInternal.h | 10 - React/Base/RCTTVRemoteHandler.h | 31 --- React/Base/RCTTVRemoteHandler.m | 233 ---------------- React/CoreModules/BUCK | 3 - React/CoreModules/CoreModulesPlugins.h | 1 - React/CoreModules/CoreModulesPlugins.mm | 1 - React/CoreModules/RCTAsyncLocalStorage.mm | 8 - React/CoreModules/RCTDeviceInfo.mm | 10 +- React/CoreModules/RCTKeyboardObserver.mm | 8 - React/CoreModules/RCTRedBox.mm | 4 - React/CoreModules/RCTStatusBarManager.h | 2 - React/CoreModules/RCTStatusBarManager.mm | 10 - .../CoreModules/RCTTVNavigationEventEmitter.h | 14 - .../RCTTVNavigationEventEmitter.mm | 63 ----- React/CoreModules/React-CoreModules.podspec | 2 +- .../RCTInputAccessoryContentView.mm | 2 +- .../Modal/RCTFabricModalHostViewController.h | 2 - .../Modal/RCTFabricModalHostViewController.mm | 2 - .../Modal/RCTModalHostViewComponentView.mm | 2 - .../RCTSafeAreaViewComponentView.mm | 2 +- React/Modules/RCTLayoutAnimation.m | 4 - .../RCTRedBoxExtraDataViewController.m | 6 - React/Modules/RCTUIManager.m | 4 - React/Profiler/RCTProfile.m | 4 - React/React-RCTFabric.podspec | 2 +- React/Views/RCTComponentData.m | 2 - React/Views/RCTModalHostView.h | 6 - React/Views/RCTModalHostView.m | 59 +--- React/Views/RCTModalHostViewController.h | 2 - React/Views/RCTModalHostViewController.m | 6 - React/Views/RCTModalHostViewManager.m | 6 - React/Views/RCTProgressViewManager.m | 2 - React/Views/RCTTVView.h | 31 --- React/Views/RCTTVView.m | 258 ------------------ React/Views/RCTViewManager.m | 15 - React/Views/ScrollView/RCTScrollView.m | 23 +- React/Views/ScrollView/RCTScrollViewManager.m | 2 - ReactCommon/React-Fabric.podspec | 2 +- ReactCommon/ReactCommon.podspec | 2 +- .../callinvoker/React-callinvoker.podspec | 2 +- ReactCommon/jsi/React-jsi.podspec | 2 +- .../jsiexecutor/React-jsiexecutor.podspec | 2 +- .../jsinspector/React-jsinspector.podspec | 2 +- .../reactperflogger/React-perflogger.podspec | 2 +- .../React-runtimeexecutor.podspec | 2 +- ReactCommon/yoga/Yoga.podspec | 2 +- index.js | 4 - packages/rn-tester/Podfile.lock | 50 ++-- .../TVEventHandler/TVEventHandlerExample.js | 89 ------ .../rn-tester/js/utils/RNTesterList.ios.js | 5 - scripts/.tests.env | 1 - scripts/ios-configure-glog.sh | 10 - .../ios/HelloWorld.xcodeproj/project.pbxproj | 1 - third-party-podspecs/DoubleConversion.podspec | 2 +- third-party-podspecs/glog.podspec | 2 +- 93 files changed, 87 insertions(+), 1463 deletions(-) delete mode 100644 Libraries/Components/AppleTV/TVEventHandler.js delete mode 100644 Libraries/Components/Touchable/TVTouchable.js delete mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js delete mode 100644 React/Base/RCTTVRemoteHandler.h delete mode 100644 React/Base/RCTTVRemoteHandler.m delete mode 100644 React/CoreModules/RCTTVNavigationEventEmitter.h delete mode 100644 React/CoreModules/RCTTVNavigationEventEmitter.mm delete mode 100644 React/Views/RCTTVView.h delete mode 100644 React/Views/RCTTVView.m delete mode 100644 packages/rn-tester/js/examples/TVEventHandler/TVEventHandlerExample.js diff --git a/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh b/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh index 4c12de632141fd..c930937a593021 100755 --- a/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh +++ b/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh @@ -67,11 +67,6 @@ while :; do shift ;; - --tvos) - RUN_IOS=1 - shift - ;; - *) break esac diff --git a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec index ef883132395026..1fc93c03536570 100644 --- a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +++ b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec @@ -24,10 +24,10 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/actionsheetios" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "*.{m}" - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" + s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTActionSheet" s.dependency "React-Core/RCTActionSheetHeaders", version diff --git a/Libraries/Blob/React-RCTBlob.podspec b/Libraries/Blob/React-RCTBlob.podspec index 045cf27ab9d0f8..9d691b100ab9fa 100644 --- a/Libraries/Blob/React-RCTBlob.podspec +++ b/Libraries/Blob/React-RCTBlob.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{h,m,mm}" diff --git a/Libraries/Components/AppleTV/TVEventHandler.js b/Libraries/Components/AppleTV/TVEventHandler.js deleted file mode 100644 index d3f475a1fdb777..00000000000000 --- a/Libraries/Components/AppleTV/TVEventHandler.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter'; -import Platform from '../../Utilities/Platform'; -import {type EventSubscription} from '../../vendor/emitter/EventEmitter'; -import NativeTVNavigationEventEmitter from './NativeTVNavigationEventEmitter'; - -class TVEventHandler { - __nativeTVNavigationEventListener: ?EventSubscription = null; - __nativeTVNavigationEventEmitter: ?NativeEventEmitter = null; - - enable(component: ?any, callback: Function): void { - if (Platform.OS === 'ios' && !NativeTVNavigationEventEmitter) { - return; - } - - this.__nativeTVNavigationEventEmitter = new NativeEventEmitter( - NativeTVNavigationEventEmitter, - ); - this.__nativeTVNavigationEventListener = this.__nativeTVNavigationEventEmitter.addListener( - 'onHWKeyEvent', - data => { - if (callback) { - callback(component, data); - } - }, - ); - } - - disable(): void { - if (this.__nativeTVNavigationEventListener) { - this.__nativeTVNavigationEventListener.remove(); - delete this.__nativeTVNavigationEventListener; - } - if (this.__nativeTVNavigationEventEmitter) { - delete this.__nativeTVNavigationEventEmitter; - } - } -} - -module.exports = TVEventHandler; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 4da263df2e56a6..a069a24c733b87 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -1206,13 +1206,12 @@ class ScrollView extends React.Component { if (refreshControl) { if (Platform.OS === 'ios') { // On iOS the RefreshControl is a child of the ScrollView. - // tvOS lacks native support for RefreshControl, so don't include it in that case return ( /* $FlowFixMe(>=0.117.0 site=react_native_fb) This comment suppresses * an error found when Flow v0.117 was deployed. To see the error, * delete this comment and run Flow. */ - {Platform.isTV ? null : refreshControl} + {refreshControl} {contentContainer} ); diff --git a/Libraries/Components/Touchable/TVTouchable.js b/Libraries/Components/Touchable/TVTouchable.js deleted file mode 100644 index 01e51ba766509a..00000000000000 --- a/Libraries/Components/Touchable/TVTouchable.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import invariant from 'invariant'; -import ReactNative from '../../Renderer/shims/ReactNative'; -import type { - BlurEvent, - FocusEvent, - PressEvent, -} from '../../Types/CoreEventTypes'; -import Platform from '../../Utilities/Platform'; -import TVEventHandler from '../../Components/AppleTV/TVEventHandler'; - -type TVTouchableConfig = $ReadOnly<{| - getDisabled: () => boolean, - onBlur: (event: BlurEvent) => mixed, - onFocus: (event: FocusEvent) => mixed, - onPress: (event: PressEvent) => mixed, -|}>; - -export default class TVTouchable { - _tvEventHandler: TVEventHandler; - - constructor(component: any, config: TVTouchableConfig) { - invariant(Platform.isTV, 'TVTouchable: Requires `Platform.isTV`.'); - this._tvEventHandler = new TVEventHandler(); - this._tvEventHandler.enable(component, (_, tvData) => { - tvData.dispatchConfig = {}; - if (ReactNative.findNodeHandle(component) === tvData.tag) { - if (tvData.eventType === 'focus') { - config.onFocus(tvData); - } else if (tvData.eventType === 'blur') { - config.onBlur(tvData); - } else if (tvData.eventType === 'select') { - if (!config.getDisabled()) { - config.onPress(tvData); - } - } - } - }); - } - - destroy(): void { - this._tvEventHandler.disable(); - } -} diff --git a/Libraries/Components/Touchable/Touchable.js b/Libraries/Components/Touchable/Touchable.js index 8bfa1cb75eeb26..8b232d13d467be 100644 --- a/Libraries/Components/Touchable/Touchable.js +++ b/Libraries/Components/Touchable/Touchable.js @@ -16,7 +16,6 @@ const Position = require('./Position'); const React = require('react'); const ReactNative = require('../../Renderer/shims/ReactNative'); const StyleSheet = require('../../StyleSheet/StyleSheet'); -const TVEventHandler = require('../AppleTV/TVEventHandler'); const UIManager = require('../../ReactNative/UIManager'); const View = require('../View/View'); const SoundManager = require('../Sound/SoundManager'); @@ -370,33 +369,12 @@ const TouchableMixin = { if (!Platform.isTV) { return; } - - this._tvEventHandler = new TVEventHandler(); - this._tvEventHandler.enable(this, function(cmp, evt) { - const myTag = ReactNative.findNodeHandle(cmp); - evt.dispatchConfig = {}; - if (myTag === evt.tag) { - if (evt.eventType === 'focus') { - cmp.touchableHandleFocus(evt); - } else if (evt.eventType === 'blur') { - cmp.touchableHandleBlur(evt); - } else if (evt.eventType === 'select' && Platform.OS !== 'android') { - cmp.touchableHandlePress && - !cmp.props.disabled && - cmp.touchableHandlePress(evt); - } - } - }); }, /** * Clear all timeouts on unmount */ componentWillUnmount: function() { - if (this._tvEventHandler) { - this._tvEventHandler.disable(); - delete this._tvEventHandler; - } this.touchableDelayTimeout && clearTimeout(this.touchableDelayTimeout); this.longPressDelayTimeout && clearTimeout(this.longPressDelayTimeout); this.pressOutDelayTimeout && clearTimeout(this.pressOutDelayTimeout); diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index 0403be409eca60..49a9a35f078d64 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -15,7 +15,6 @@ import Pressability, { } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import TVTouchable from './TVTouchable'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import {Animated, Platform} from 'react-native'; import * as React from 'react'; @@ -38,8 +37,6 @@ type State = $ReadOnly<{| |}>; class TouchableBounce extends React.Component { - _tvTouchable: ?TVTouchable; - state: State = { pressability: new Pressability(this._createPressabilityConfig()), scale: new Animated.Value(1), @@ -172,39 +169,11 @@ class TouchableBounce extends React.Component { ); } - componentDidMount(): void { - if (Platform.isTV) { - this._tvTouchable = new TVTouchable(this, { - getDisabled: () => this.props.disabled === true, - onBlur: event => { - if (this.props.onBlur != null) { - this.props.onBlur(event); - } - }, - onFocus: event => { - if (this.props.onFocus != null) { - this.props.onFocus(event); - } - }, - onPress: event => { - if (this.props.onPress != null) { - this.props.onPress(event); - } - }, - }); - } - } - componentDidUpdate(prevProps: Props, prevState: State) { this.state.pressability.configure(this._createPressabilityConfig()); } componentWillUnmount(): void { - if (Platform.isTV) { - if (this._tvTouchable != null) { - this._tvTouchable.destroy(); - } - } this.state.pressability.reset(); } } diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index 9987ec7f704245..327d455e283b6c 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -16,7 +16,6 @@ import Pressability, { import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import StyleSheet, {type ViewStyleProp} from '../../StyleSheet/StyleSheet'; import type {ColorValue} from '../../StyleSheet/StyleSheet'; -import TVTouchable from './TVTouchable'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import Platform from '../../Utilities/Platform'; import View from '../../Components/View/View'; @@ -158,7 +157,6 @@ type State = $ReadOnly<{| class TouchableHighlight extends React.Component { _hideTimeout: ?TimeoutID; _isMounted: boolean = false; - _tvTouchable: ?TVTouchable; state: State = { pressability: new Pressability(this._createPressabilityConfig()), @@ -335,26 +333,6 @@ class TouchableHighlight extends React.Component { componentDidMount(): void { this._isMounted = true; - if (Platform.isTV) { - this._tvTouchable = new TVTouchable(this, { - getDisabled: () => this.props.disabled === true, - onBlur: event => { - if (this.props.onBlur != null) { - this.props.onBlur(event); - } - }, - onFocus: event => { - if (this.props.onFocus != null) { - this.props.onFocus(event); - } - }, - onPress: event => { - if (this.props.onPress != null) { - this.props.onPress(event); - } - }, - }); - } } componentDidUpdate(prevProps: Props, prevState: State) { @@ -366,11 +344,6 @@ class TouchableHighlight extends React.Component { if (this._hideTimeout != null) { clearTimeout(this._hideTimeout); } - if (Platform.isTV) { - if (this._tvTouchable != null) { - this._tvTouchable.destroy(); - } - } this.state.pressability.reset(); } } diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.js b/Libraries/Components/Touchable/TouchableNativeFeedback.js index dda6c4bf371093..907f9670537f52 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -14,7 +14,6 @@ import Pressability, { type PressabilityConfig, } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; -import TVTouchable from './TVTouchable'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import {Commands} from 'react-native/Libraries/Components/View/ViewNativeComponent'; import ReactNative from 'react-native/Libraries/Renderer/shims/ReactNative'; @@ -164,8 +163,6 @@ class TouchableNativeFeedback extends React.Component { static canUseNativeForeground: () => boolean = () => Platform.OS === 'android' && Platform.Version >= 23; - _tvTouchable: ?TVTouchable; - state: State = { pressability: new Pressability(this._createPressabilityConfig()), }; @@ -301,39 +298,11 @@ class TouchableNativeFeedback extends React.Component { ); } - componentDidMount(): void { - if (Platform.isTV) { - this._tvTouchable = new TVTouchable(this, { - getDisabled: () => this.props.disabled === true, - onBlur: event => { - if (this.props.onBlur != null) { - this.props.onBlur(event); - } - }, - onFocus: event => { - if (this.props.onFocus != null) { - this.props.onFocus(event); - } - }, - onPress: event => { - if (this.props.onPress != null) { - this.props.onPress(event); - } - }, - }); - } - } - componentDidUpdate(prevProps: Props, prevState: State) { this.state.pressability.configure(this._createPressabilityConfig()); } componentWillUnmount(): void { - if (Platform.isTV) { - if (this._tvTouchable != null) { - this._tvTouchable.destroy(); - } - } this.state.pressability.reset(); } } diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index f1d09510e03cb8..8023030a36f962 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -14,7 +14,6 @@ import Pressability, { type PressabilityConfig, } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; -import TVTouchable from './TVTouchable'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import Animated from 'react-native/Libraries/Animated/Animated'; import Easing from 'react-native/Libraries/Animated/Easing'; @@ -132,8 +131,6 @@ type State = $ReadOnly<{| * */ class TouchableOpacity extends React.Component { - _tvTouchable: ?TVTouchable; - state: State = { anim: new Animated.Value(this._getChildStyleOpacityWithDefault()), pressability: new Pressability(this._createPressabilityConfig()), @@ -258,29 +255,6 @@ class TouchableOpacity extends React.Component { ); } - componentDidMount(): void { - if (Platform.isTV) { - this._tvTouchable = new TVTouchable(this, { - getDisabled: () => this.props.disabled === true, - onBlur: event => { - if (this.props.onBlur != null) { - this.props.onBlur(event); - } - }, - onFocus: event => { - if (this.props.onFocus != null) { - this.props.onFocus(event); - } - }, - onPress: event => { - if (this.props.onPress != null) { - this.props.onPress(event); - } - }, - }); - } - } - componentDidUpdate(prevProps: Props, prevState: State) { this.state.pressability.configure(this._createPressabilityConfig()); if (this.props.disabled !== prevProps.disabled) { @@ -289,11 +263,6 @@ class TouchableOpacity extends React.Component { } componentWillUnmount(): void { - if (Platform.isTV) { - if (this._tvTouchable != null) { - this._tvTouchable.destroy(); - } - } this.state.pressability.reset(); } } diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 0cb20d0dbad078..d50b1b0bcb1a4d 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -14,7 +14,6 @@ import Pressability, { type PressabilityConfig, } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; -import TVTouchable from './TVTouchable'; import type { AccessibilityActionEvent, AccessibilityActionInfo, @@ -94,8 +93,6 @@ const PASSTHROUGH_PROPS = [ ]; class TouchableWithoutFeedback extends React.Component { - _tvTouchable: ?TVTouchable; - state: State = { pressability: new Pressability(createPressabilityConfig(this.props)), }; @@ -134,39 +131,11 @@ class TouchableWithoutFeedback extends React.Component { return React.cloneElement(element, elementProps, ...children); } - componentDidMount(): void { - if (Platform.isTV) { - this._tvTouchable = new TVTouchable(this, { - getDisabled: () => this.props.disabled === true, - onBlur: event => { - if (this.props.onBlur != null) { - this.props.onBlur(event); - } - }, - onFocus: event => { - if (this.props.onFocus != null) { - this.props.onFocus(event); - } - }, - onPress: event => { - if (this.props.onPress != null) { - this.props.onPress(event); - } - }, - }); - } - } - componentDidUpdate(): void { this.state.pressability.configure(createPressabilityConfig(this.props)); } componentWillUnmount(): void { - if (Platform.isTV) { - if (this._tvTouchable != null) { - this._tvTouchable.destroy(); - } - } this.state.pressability.reset(); } } diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js deleted file mode 100644 index 22628f0e469446..00000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const DeprecatedTVViewPropTypes = { - hasTVPreferredFocus: PropTypes.bool, - tvParallaxShiftDistanceX: PropTypes.number, - tvParallaxShiftDistanceY: PropTypes.number, - tvParallaxTiltAngle: PropTypes.number, - tvParallaxMagnification: PropTypes.number, -}; - -module.exports = DeprecatedTVViewPropTypes; diff --git a/Libraries/FBLazyVector/FBLazyVector.podspec b/Libraries/FBLazyVector/FBLazyVector.podspec index 439c326f9de31f..925860e7e9f242 100644 --- a/Libraries/FBLazyVector/FBLazyVector.podspec +++ b/Libraries/FBLazyVector/FBLazyVector.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" s.header_dir = "FBLazyVector" diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec b/Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec index bd2a78e45cccbb..de5e03607754d2 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" diff --git a/Libraries/Image/React-RCTImage.podspec b/Libraries/Image/React-RCTImage.podspec index d0de0bd722e4e1..2678065c862b1e 100644 --- a/Libraries/Image/React-RCTImage.podspec +++ b/Libraries/Image/React-RCTImage.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/image" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/LinkingIOS/React-RCTLinking.podspec b/Libraries/LinkingIOS/React-RCTLinking.podspec index 5f07abebc676a3..fe2c5d33079dec 100644 --- a/Libraries/LinkingIOS/React-RCTLinking.podspec +++ b/Libraries/LinkingIOS/React-RCTLinking.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/linking" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/NativeAnimation/React-RCTAnimation.podspec b/Libraries/NativeAnimation/React-RCTAnimation.podspec index 01f605c9822f46..cf09cbff7c0c05 100644 --- a/Libraries/NativeAnimation/React-RCTAnimation.podspec +++ b/Libraries/NativeAnimation/React-RCTAnimation.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "{Drivers/*,Nodes/*,*}.{m,mm}" diff --git a/Libraries/Network/React-RCTNetwork.podspec b/Libraries/Network/React-RCTNetwork.podspec index e21afd21a309d7..e868267d51d079 100644 --- a/Libraries/Network/React-RCTNetwork.podspec +++ b/Libraries/Network/React-RCTNetwork.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index c4281361e6d673..e486252c704b4a 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -13,7 +13,7 @@ extern NSString *const RCTRemoteNotificationReceived; typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); -#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC +#if !TARGET_OS_UIKITFORMAC + (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; + (void)didReceiveRemoteNotification:(NSDictionary *)notification; diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index 95eec384e9a9a6..02fb7e4214bdcb 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -25,7 +25,7 @@ static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS"; -#if !TARGET_OS_TV +#if !TARGET_OS_UIKITFORMAC @implementation RCTConvert (NSCalendarUnit) RCT_ENUM_CONVERTER(NSCalendarUnit, @@ -79,11 +79,11 @@ + (UILocalNotification *)UILocalNotification:(id)json #else @interface RCTPushNotificationManager () @end -#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC +#endif // TARGET_OS_UIKITFORMAC @implementation RCTPushNotificationManager -#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC +#if !TARGET_OS_UIKITFORMAC static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) { @@ -128,7 +128,7 @@ @implementation RCTPushNotificationManager return formattedNotification; } -#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC +#endif // TARGET_OS_UIKITFORMAC RCT_EXPORT_MODULE() @@ -137,7 +137,7 @@ - (dispatch_queue_t)methodQueue return dispatch_get_main_queue(); } -#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC +#if !TARGET_OS_UIKITFORMAC - (void)startObserving { [[NSNotificationCenter defaultCenter] addObserver:self @@ -472,7 +472,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification }]; } -#else //TARGET_OS_TV / TARGET_OS_UIKITFORMAC +#else // TARGET_OS_UIKITFORMAC RCT_EXPORT_METHOD(onFinishRemoteNotification:(NSString *)notificationId fetchResult:(NSString *)fetchResult) { @@ -557,7 +557,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification return @[]; } -#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC +#endif // TARGET_OS_UIKITFORMAC - (std::shared_ptr)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params { diff --git a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec index a2c915316eb7a0..f1f734adabd1a4 100644 --- a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +++ b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/pushnotificationios" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/RCTRequired/RCTRequired.podspec b/Libraries/RCTRequired/RCTRequired.podspec index 3c55234fbd3e50..45d537db606814 100644 --- a/Libraries/RCTRequired/RCTRequired.podspec +++ b/Libraries/RCTRequired/RCTRequired.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" s.header_dir = "RCTRequired" diff --git a/Libraries/Settings/React-RCTSettings.podspec b/Libraries/Settings/React-RCTSettings.podspec index 45c92ba557b623..c9790ff0e8e29d 100644 --- a/Libraries/Settings/React-RCTSettings.podspec +++ b/Libraries/Settings/React-RCTSettings.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/settings" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/Text/React-RCTText.podspec b/Libraries/Text/React-RCTText.podspec index 6f94706d54e3bc..af8a8f6ec70156 100644 --- a/Libraries/Text/React-RCTText.podspec +++ b/Libraries/Text/React-RCTText.podspec @@ -24,7 +24,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/text" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{h,m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index 0c13d038cb3502..bda5f8d078f428 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -227,7 +227,7 @@ - (void)disableContextMenu - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { // TODO: Adopt showMenuFromRect (necessary for UIKitForMac) -#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC +#if !TARGET_OS_UIKITFORMAC UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController.isMenuVisible) { @@ -259,7 +259,6 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender - (void)copy:(id)sender { -#if !TARGET_OS_TV NSAttributedString *attributedText = _textStorage; NSMutableDictionary *item = [NSMutableDictionary new]; @@ -276,7 +275,6 @@ - (void)copy:(id)sender UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.items = @[item]; -#endif } @end diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m index 6f9696029b049f..7a661b183fa008 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m @@ -19,8 +19,6 @@ - (UIView *)view #pragma mark - Multiline (aka TextView) specific properties -#if !TARGET_OS_TV RCT_REMAP_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.dataDetectorTypes, UIDataDetectorTypes) -#endif @end diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.m b/Libraries/Text/TextInput/Multiline/RCTUITextView.m index a949f1d73b103f..a417cc11751099 100644 --- a/Libraries/Text/TextInput/Multiline/RCTUITextView.m +++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.m @@ -51,9 +51,7 @@ - (instancetype)initWithFrame:(CGRect)frame self.textColor = [UIColor blackColor]; // This line actually removes 5pt (default value) left and right padding in UITextView. self.textContainer.lineFragmentPadding = 0; -#if !TARGET_OS_TV self.scrollsToTop = NO; -#endif self.scrollEnabled = YES; } diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 9edad515f00861..01ab7f19d12267 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -245,7 +245,7 @@ - (void)setTextContentType:(NSString *)type }; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if (@available(iOS 11.0, tvOS 11.0, *)) { + if (@available(iOS 11.0, *)) { NSDictionary * iOS11extras = @{@"username": UITextContentTypeUsername, @"password": UITextContentTypePassword}; @@ -257,7 +257,7 @@ - (void)setTextContentType:(NSString *)type #endif #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */ - if (@available(iOS 12.0, tvOS 12.0, *)) { + if (@available(iOS 12.0, *)) { NSDictionary * iOS12extras = @{@"newPassword": UITextContentTypeNewPassword, @"oneTimeCode": UITextContentTypeOneTimeCode}; @@ -572,7 +572,6 @@ - (void)didSetProps:(NSArray *)changedProps - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID { - #if !TARGET_OS_TV __weak RCTBaseTextInputView *weakSelf = self; [_bridge.uiManager rootViewForReactTag:self.reactTag withCompletion:^(UIView *rootView) { RCTBaseTextInputView *strongSelf = weakSelf; @@ -585,12 +584,10 @@ - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID } } }]; - #endif /* !TARGET_OS_TV */ } - (void)setDefaultInputAccessoryView { - #if !TARGET_OS_TV UIView *textInputView = self.backedTextInputView; UIKeyboardType keyboardType = textInputView.keyboardType; @@ -629,7 +626,6 @@ - (void)setDefaultInputAccessoryView textInputView.inputAccessoryView = nil; } [self reloadInputViewsIfNecessary]; - #endif /* !TARGET_OS_TV */ } - (void)reloadInputViewsIfNecessary diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m index de77e47bf2d0d7..35db4d308733c4 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m @@ -30,7 +30,7 @@ - (instancetype)init _heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0]; _heightConstraint.active = YES; - if (@available(iOS 11.0, tvOS 11.0, *)) { + if (@available(iOS 11.0, *)) { [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor].active = YES; [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES; [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor].active = YES; diff --git a/Libraries/TypeSafety/RCTTypeSafety.podspec b/Libraries/TypeSafety/RCTTypeSafety.podspec index 1dd04a8c29a6e8..96d90e6949b1de 100644 --- a/Libraries/TypeSafety/RCTTypeSafety.podspec +++ b/Libraries/TypeSafety/RCTTypeSafety.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" diff --git a/Libraries/Utilities/BackHandler.android.js b/Libraries/Utilities/BackHandler.android.js index e762c1635f93f7..efb07ec5918ea6 100644 --- a/Libraries/Utilities/BackHandler.android.js +++ b/Libraries/Utilities/BackHandler.android.js @@ -35,10 +35,6 @@ RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function() { * Android: Detect hardware back button presses, and programmatically invoke the default back button * functionality to exit the app if there are no listeners or if none of the listeners return true. * - * tvOS: Detect presses of the menu button on the TV remote. (Still to be implemented: - * programmatically disable menu button handling - * functionality to exit the app if there are no listeners or if none of the listeners return true.) - * * iOS: Not applicable. * * The event subscriptions are called in reverse order (i.e. last registered subscription first), @@ -82,8 +78,7 @@ const BackHandler: TBackHandler = { /** * Adds an event handler. Supported events: * - * - `hardwareBackPress`: Fires when the Android hardware back button is pressed or when the - * tvOS menu button is pressed. + * - `hardwareBackPress`: Fires when the Android hardware back button is pressed. */ addEventListener: function( eventName: BackPressEventName, diff --git a/Libraries/Utilities/BackHandler.ios.js b/Libraries/Utilities/BackHandler.ios.js index 1407a57e95ff0d..2e1e5c4cd2a7ac 100644 --- a/Libraries/Utilities/BackHandler.ios.js +++ b/Libraries/Utilities/BackHandler.ios.js @@ -4,52 +4,18 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local * @format + * @flow */ -// On Apple TV, this implements back navigation using the TV remote's menu button. -// On iOS, this just implements a stub. - 'use strict'; -const Platform = require('./Platform'); -const TVEventHandler = require('../Components/AppleTV/TVEventHandler'); +module.exports = require('../Components/UnimplementedViews/UnimplementedView'); type BackPressEventName = 'backPress' | 'hardwareBackPress'; function emptyFunction(): void {} -/** - * Detect hardware button presses for back navigation. - * - * Android: Detect hardware back button presses, and programmatically invoke the default back button - * functionality to exit the app if there are no listeners or if none of the listeners return true. - * - * tvOS: Detect presses of the menu button on the TV remote. (Still to be implemented: - * programmatically disable menu button handling - * functionality to exit the app if there are no listeners or if none of the listeners return true.) - * - * iOS: Not applicable. - * - * The event subscriptions are called in reverse order (i.e. last registered subscription first), - * and if one subscription returns true then subscriptions registered earlier will not be called. - * - * Example: - * - * ```javascript - * BackHandler.addEventListener('hardwareBackPress', function() { - * // this.onMainScreen and this.goBack are just examples, you need to use your own implementation here - * // Typically you would use the navigator here to go to the last state. - * - * if (!this.onMainScreen()) { - * this.goBack(); - * return true; - * } - * return false; - * }); - * ``` - */ type TBackHandler = {| +exitApp: () => void, +addEventListener: ( @@ -62,65 +28,14 @@ type TBackHandler = {| ) => void, |}; -let BackHandler: TBackHandler; - -if (Platform.isTV) { - const _tvEventHandler = new TVEventHandler(); - const _backPressSubscriptions = new Set(); - - _tvEventHandler.enable(this, function(cmp, evt) { - if (evt && evt.eventType === 'menu') { - let invokeDefault = true; - const subscriptions = Array.from( - _backPressSubscriptions.values(), - ).reverse(); - - for (let i = 0; i < subscriptions.length; ++i) { - if (subscriptions[i]()) { - invokeDefault = false; - break; - } - } - - if (invokeDefault) { - BackHandler.exitApp(); - } - } - }); - - BackHandler = { - exitApp: emptyFunction, - - addEventListener: function( - eventName: BackPressEventName, - handler: () => ?boolean, - ): {remove: () => void, ...} { - _backPressSubscriptions.add(handler); - return { - remove: () => BackHandler.removeEventListener(eventName, handler), - }; - }, - - removeEventListener: function( - eventName: BackPressEventName, - handler: () => ?boolean, - ): void { - _backPressSubscriptions.delete(handler); - }, - }; -} else { - BackHandler = { - exitApp: emptyFunction, - addEventListener(_eventName: BackPressEventName, _handler: () => ?boolean) { - return { - remove: emptyFunction, - }; - }, - removeEventListener( - _eventName: BackPressEventName, - _handler: () => ?boolean, - ) {}, - }; -} +let BackHandler: TBackHandler = { + exitApp: emptyFunction, + addEventListener(_eventName: BackPressEventName, _handler: Function) { + return { + remove: emptyFunction, + }; + }, + removeEventListener(_eventName: BackPressEventName, _handler: Function) {}, +}; module.exports = BackHandler; diff --git a/Libraries/Vibration/React-RCTVibration.podspec b/Libraries/Vibration/React-RCTVibration.podspec index c08abe6407cc3a..87e0659e4d1c4f 100644 --- a/Libraries/Vibration/React-RCTVibration.podspec +++ b/Libraries/Vibration/React-RCTVibration.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/vibration" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/React-Core.podspec b/React-Core.podspec index 7079adab55bb27..5c69ed70f06778 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -41,7 +41,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.resource_bundle = { "AccessibilityResources" => ["React/AccessibilityResources/*.lproj"]} s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags @@ -59,13 +59,6 @@ Pod::Spec.new do |s| "React/Fabric/**/*", "React/Tests/**/*", "React/Inspector/**/*" - ss.ios.exclude_files = "React/**/RCTTV*.*" - ss.tvos.exclude_files = "React/Modules/RCTClipboard*", - "React/Views/RCTDatePicker*", - "React/Views/RCTPicker*", - "React/Views/RCTRefreshControl*", - "React/Views/RCTSlider*", - "React/Views/RCTSwitch*", ss.private_header_files = "React/Cxx*/*.h" end diff --git a/React.podspec b/React.podspec index da482ff0154c7e..a6511d2d1aeadb 100644 --- a/React.podspec +++ b/React.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.cocoapods_version = ">= 1.2.0" diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index f3588b38ecb503..7ef3b233893ae9 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -416,7 +416,6 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC return type; } -#if !TARGET_OS_TV RCT_MULTI_ENUM_CONVERTER( UIDataDetectorTypes, (@{ @@ -446,8 +445,6 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC WKDataDetectorTypePhoneNumber, unsignedLongLongValue) -#endif // !TARGET_OS_TV - RCT_ENUM_CONVERTER( UIKeyboardAppearance, (@{ @@ -500,7 +497,6 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC UIViewContentModeScaleAspectFill, integerValue) -#if !TARGET_OS_TV RCT_ENUM_CONVERTER( UIBarStyle, (@{ @@ -511,7 +507,6 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC }), UIBarStyleDefault, integerValue) -#endif static void convertCGStruct(const char *type, NSArray *fields, CGFloat *result, id json) { diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index 013c7506850fd2..d9fbc37b38dfae 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -29,11 +29,6 @@ #import "RCTView.h" #import "UIView+React.h" -#if TARGET_OS_TV -#import "RCTTVNavigationEventEmitter.h" -#import "RCTTVRemoteHandler.h" -#endif - NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification"; @interface RCTUIManager (RCTRootView) @@ -89,13 +84,6 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge name:RCTContentDidAppearNotification object:self]; -#if TARGET_OS_TV - self.tvRemoteHandler = [RCTTVRemoteHandler new]; - for (NSString *key in [self.tvRemoteHandler.tvRemoteGestureRecognizers allKeys]) { - [self addGestureRecognizer:self.tvRemoteHandler.tvRemoteGestureRecognizers[key]]; - } -#endif - [self showLoadingView]; // Immediately schedule the application to be started. @@ -121,16 +109,6 @@ - (instancetype)initWithBundleURL:(NSURL *)bundleURL RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) -#if TARGET_OS_TV -- (UIView *)preferredFocusedView -{ - if (self.reactPreferredFocusedView) { - return self.reactPreferredFocusedView; - } - return [super preferredFocusedView]; -} -#endif - #pragma mark - passThroughTouches - (BOOL)passThroughTouches diff --git a/React/Base/RCTRootViewInternal.h b/React/Base/RCTRootViewInternal.h index c6a21c9ab1cb2f..8e28dd453570c1 100644 --- a/React/Base/RCTRootViewInternal.h +++ b/React/Base/RCTRootViewInternal.h @@ -7,8 +7,6 @@ #import -@class RCTTVRemoteHandler; - /** * The interface provides a set of functions that allow other internal framework * classes to change the RCTRootViews's internal state. @@ -21,14 +19,6 @@ */ @property (readwrite, nonatomic, assign) CGSize intrinsicContentSize; -/** - * TV remote gesture recognizers - */ -#if TARGET_OS_TV -@property (nonatomic, strong) RCTTVRemoteHandler *tvRemoteHandler; -@property (nonatomic, strong) UIView *reactPreferredFocusedView; -#endif - - (void)contentViewInvalidated; @end diff --git a/React/Base/RCTTVRemoteHandler.h b/React/Base/RCTTVRemoteHandler.h deleted file mode 100644 index 10d56906901677..00000000000000 --- a/React/Base/RCTTVRemoteHandler.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -extern NSString *const RCTTVRemoteEventMenu; -extern NSString *const RCTTVRemoteEventPlayPause; -extern NSString *const RCTTVRemoteEventSelect; - -extern NSString *const RCTTVRemoteEventLongPlayPause; -extern NSString *const RCTTVRemoteEventLongSelect; - -extern NSString *const RCTTVRemoteEventLeft; -extern NSString *const RCTTVRemoteEventRight; -extern NSString *const RCTTVRemoteEventUp; -extern NSString *const RCTTVRemoteEventDown; - -extern NSString *const RCTTVRemoteEventSwipeLeft; -extern NSString *const RCTTVRemoteEventSwipeRight; -extern NSString *const RCTTVRemoteEventSwipeUp; -extern NSString *const RCTTVRemoteEventSwipeDown; - -@interface RCTTVRemoteHandler : NSObject - -@property (nonatomic, copy, readonly) NSDictionary *tvRemoteGestureRecognizers; - -@end diff --git a/React/Base/RCTTVRemoteHandler.m b/React/Base/RCTTVRemoteHandler.m deleted file mode 100644 index aadbacec4b7eb5..00000000000000 --- a/React/Base/RCTTVRemoteHandler.m +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTVRemoteHandler.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTRootView.h" -#import "RCTTVNavigationEventEmitter.h" -#import "RCTUIManager.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" - -#if __has_include("RCTDevMenu.h") -#import "RCTDevMenu.h" -#endif - -NSString *const RCTTVRemoteEventMenu = @"menu"; -NSString *const RCTTVRemoteEventPlayPause = @"playPause"; -NSString *const RCTTVRemoteEventSelect = @"select"; - -NSString *const RCTTVRemoteEventLongPlayPause = @"longPlayPause"; -NSString *const RCTTVRemoteEventLongSelect = @"longSelect"; - -NSString *const RCTTVRemoteEventLeft = @"left"; -NSString *const RCTTVRemoteEventRight = @"right"; -NSString *const RCTTVRemoteEventUp = @"up"; -NSString *const RCTTVRemoteEventDown = @"down"; - -NSString *const RCTTVRemoteEventSwipeLeft = @"swipeLeft"; -NSString *const RCTTVRemoteEventSwipeRight = @"swipeRight"; -NSString *const RCTTVRemoteEventSwipeUp = @"swipeUp"; -NSString *const RCTTVRemoteEventSwipeDown = @"swipeDown"; - -@implementation RCTTVRemoteHandler { - NSMutableDictionary *_tvRemoteGestureRecognizers; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _tvRemoteGestureRecognizers = [NSMutableDictionary dictionary]; - - // Recognizers for Apple TV remote buttons - - // Play/Pause - [self addTapGestureRecognizerWithSelector:@selector(playPausePressed:) - pressType:UIPressTypePlayPause - name:RCTTVRemoteEventPlayPause]; - - // Menu - [self addTapGestureRecognizerWithSelector:@selector(menuPressed:) - pressType:UIPressTypeMenu - name:RCTTVRemoteEventMenu]; - - // Select - [self addTapGestureRecognizerWithSelector:@selector(selectPressed:) - pressType:UIPressTypeSelect - name:RCTTVRemoteEventSelect]; - - // Up - [self addTapGestureRecognizerWithSelector:@selector(tappedUp:) - pressType:UIPressTypeUpArrow - name:RCTTVRemoteEventUp]; - - // Down - [self addTapGestureRecognizerWithSelector:@selector(tappedDown:) - pressType:UIPressTypeDownArrow - name:RCTTVRemoteEventDown]; - - // Left - [self addTapGestureRecognizerWithSelector:@selector(tappedLeft:) - pressType:UIPressTypeLeftArrow - name:RCTTVRemoteEventLeft]; - - // Right - [self addTapGestureRecognizerWithSelector:@selector(tappedRight:) - pressType:UIPressTypeRightArrow - name:RCTTVRemoteEventRight]; - - // Recognizers for long button presses - // We don't intercept long menu press -- that's used by the system to go to the home screen - - [self addLongPressGestureRecognizerWithSelector:@selector(longPlayPausePressed:) - pressType:UIPressTypePlayPause - name:RCTTVRemoteEventLongPlayPause]; - - [self addLongPressGestureRecognizerWithSelector:@selector(longSelectPressed:) - pressType:UIPressTypeSelect - name:RCTTVRemoteEventLongSelect]; - - // Recognizers for Apple TV remote trackpad swipes - - // Up - [self addSwipeGestureRecognizerWithSelector:@selector(swipedUp:) - direction:UISwipeGestureRecognizerDirectionUp - name:RCTTVRemoteEventSwipeUp]; - - // Down - [self addSwipeGestureRecognizerWithSelector:@selector(swipedDown:) - direction:UISwipeGestureRecognizerDirectionDown - name:RCTTVRemoteEventSwipeDown]; - - // Left - [self addSwipeGestureRecognizerWithSelector:@selector(swipedLeft:) - direction:UISwipeGestureRecognizerDirectionLeft - name:RCTTVRemoteEventSwipeLeft]; - - // Right - [self addSwipeGestureRecognizerWithSelector:@selector(swipedRight:) - direction:UISwipeGestureRecognizerDirectionRight - name:RCTTVRemoteEventSwipeRight]; - } - - return self; -} - -- (void)playPausePressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventPlayPause toView:r.view]; -} - -- (void)menuPressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventMenu toView:r.view]; -} - -- (void)selectPressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSelect toView:r.view]; -} - -- (void)longPlayPausePressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventLongPlayPause toView:r.view]; - -#if __has_include("RCTDevMenu.h") && RCT_DEV - // If shake to show is enabled on device, use long play/pause event to show dev menu - [[NSNotificationCenter defaultCenter] postNotificationName:RCTShowDevMenuNotification object:nil]; -#endif -} - -- (void)longSelectPressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventLongSelect toView:r.view]; -} - -- (void)swipedUp:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeUp toView:r.view]; -} - -- (void)swipedDown:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeDown toView:r.view]; -} - -- (void)swipedLeft:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeLeft toView:r.view]; -} - -- (void)swipedRight:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeRight toView:r.view]; -} - -- (void)tappedUp:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventUp toView:r.view]; -} - -- (void)tappedDown:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventDown toView:r.view]; -} - -- (void)tappedLeft:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventLeft toView:r.view]; -} - -- (void)tappedRight:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventRight toView:r.view]; -} - -#pragma mark - - -- (void)addLongPressGestureRecognizerWithSelector:(nonnull SEL)selector - pressType:(UIPressType)pressType - name:(NSString *)name -{ - UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:selector]; - recognizer.allowedPressTypes = @[ @(pressType) ]; - - _tvRemoteGestureRecognizers[name] = recognizer; -} - -- (void)addTapGestureRecognizerWithSelector:(nonnull SEL)selector pressType:(UIPressType)pressType name:(NSString *)name -{ - UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:selector]; - recognizer.allowedPressTypes = @[ @(pressType) ]; - - _tvRemoteGestureRecognizers[name] = recognizer; -} - -- (void)addSwipeGestureRecognizerWithSelector:(nonnull SEL)selector - direction:(UISwipeGestureRecognizerDirection)direction - name:(NSString *)name -{ - UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:selector]; - recognizer.direction = direction; - - _tvRemoteGestureRecognizers[name] = recognizer; -} - -- (void)sendAppleTVEvent:(NSString *)eventType toView:(__unused UIView *)v -{ - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType" : eventType}]; -} - -@end diff --git a/React/CoreModules/BUCK b/React/CoreModules/BUCK index 2f9902478139d5..45b4b45f0daf1b 100644 --- a/React/CoreModules/BUCK +++ b/React/CoreModules/BUCK @@ -104,9 +104,6 @@ rn_apple_library( ) + react_module_plugin_providers( name = "LogBox", native_class_func = "RCTLogBoxCls", - ) + react_module_plugin_providers( - name = "TVNavigationEventEmitter", - native_class_func = "RCTTVNavigationEventEmitterCls", ) + react_module_plugin_providers( name = "WebSocketExecutor", native_class_func = "RCTWebSocketExecutorCls", diff --git a/React/CoreModules/CoreModulesPlugins.h b/React/CoreModules/CoreModulesPlugins.h index 509eb5af2f8dbc..b8fa8e9f0767ed 100644 --- a/React/CoreModules/CoreModulesPlugins.h +++ b/React/CoreModules/CoreModulesPlugins.h @@ -49,7 +49,6 @@ Class RCTDevMenuCls(void) __attribute__((used)); Class RCTDevSettingsCls(void) __attribute__((used)); Class RCTRedBoxCls(void) __attribute__((used)); Class RCTLogBoxCls(void) __attribute__((used)); -Class RCTTVNavigationEventEmitterCls(void) __attribute__((used)); Class RCTWebSocketExecutorCls(void) __attribute__((used)); Class RCTWebSocketModuleCls(void) __attribute__((used)); Class RCTDevLoadingViewCls(void) __attribute__((used)); diff --git a/React/CoreModules/CoreModulesPlugins.mm b/React/CoreModules/CoreModulesPlugins.mm index ced0cbd0797bbe..de47e923f813d7 100644 --- a/React/CoreModules/CoreModulesPlugins.mm +++ b/React/CoreModules/CoreModulesPlugins.mm @@ -38,7 +38,6 @@ Class RCTCoreModulesClassProvider(const char *name) { {"DevSettings", RCTDevSettingsCls}, {"RedBox", RCTRedBoxCls}, {"LogBox", RCTLogBoxCls}, - {"TVNavigationEventEmitter", RCTTVNavigationEventEmitterCls}, {"WebSocketExecutor", RCTWebSocketExecutorCls}, {"WebSocketModule", RCTWebSocketModuleCls}, {"DevLoadingView", RCTDevLoadingViewCls}, diff --git a/React/CoreModules/RCTAsyncLocalStorage.mm b/React/CoreModules/RCTAsyncLocalStorage.mm index 00b66634f03edd..ecbb05976a0168 100644 --- a/React/CoreModules/RCTAsyncLocalStorage.mm +++ b/React/CoreModules/RCTAsyncLocalStorage.mm @@ -76,11 +76,7 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray * static NSString *storageDirectory = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ -#if TARGET_OS_TV - storageDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject; -#else storageDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject; -#endif storageDirectory = [storageDirectory stringByAppendingPathComponent:RCTStorageDirectory]; }); return storageDirectory; @@ -232,10 +228,6 @@ - (NSDictionary *)_ensureSetup { RCTAssertThread(RCTGetMethodQueue(), @"Must be executed on storage thread"); -#if TARGET_OS_TV - RCTLogWarn(@"Persistent storage is not supported on tvOS, your data may be removed at any point."); -#endif - NSError *error = nil; if (!RCTHasCreatedStorageDirectory) { [[NSFileManager defaultManager] createDirectoryAtPath:RCTGetStorageDirectory() diff --git a/React/CoreModules/RCTDeviceInfo.mm b/React/CoreModules/RCTDeviceInfo.mm index eb5f8217946238..e3ac433991568c 100644 --- a/React/CoreModules/RCTDeviceInfo.mm +++ b/React/CoreModules/RCTDeviceInfo.mm @@ -23,10 +23,8 @@ @interface RCTDeviceInfo () @end @implementation RCTDeviceInfo { -#if !TARGET_OS_TV UIInterfaceOrientation _currentInterfaceOrientation; NSDictionary *_currentInterfaceDimensions; -#endif } @synthesize bridge = _bridge; @@ -51,7 +49,7 @@ - (void)setBridge:(RCTBridge *)bridge selector:@selector(didReceiveNewContentSizeMultiplier) name:RCTAccessibilityManagerDidUpdateMultiplierNotification object:_bridge.accessibilityManager]; -#if !TARGET_OS_TV + _currentInterfaceOrientation = [RCTSharedApplication() statusBarOrientation]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -70,8 +68,6 @@ - (void)setBridge:(RCTBridge *)bridge selector:@selector(interfaceFrameDidChange) name:RCTUserInterfaceStyleDidChangeNotification object:nil]; - -#endif } static BOOL RCTIsIPhoneX() @@ -149,8 +145,6 @@ - (void)didReceiveNewContentSizeMultiplier }); } -#if !TARGET_OS_TV - - (void)interfaceOrientationDidChange { __weak __typeof(self) weakSelf = self; @@ -199,8 +193,6 @@ - (void)_interfaceFrameDidChange _currentInterfaceDimensions = nextInterfaceDimensions; } -#endif // TARGET_OS_TV - - (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params { return std::make_shared(params); diff --git a/React/CoreModules/RCTKeyboardObserver.mm b/React/CoreModules/RCTKeyboardObserver.mm index b00f08c21cabb6..93c853f7acc423 100644 --- a/React/CoreModules/RCTKeyboardObserver.mm +++ b/React/CoreModules/RCTKeyboardObserver.mm @@ -23,8 +23,6 @@ @implementation RCTKeyboardObserver - (void)startObserving { -#if !TARGET_OS_TV - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; #define ADD_KEYBOARD_HANDLER(NAME, SELECTOR) [nc addObserver:self selector:@selector(SELECTOR:) name:NAME object:nil] @@ -37,8 +35,6 @@ - (void)startObserving ADD_KEYBOARD_HANDLER(UIKeyboardDidChangeFrameNotification, keyboardDidChangeFrame); #undef ADD_KEYBOARD_HANDLER - -#endif } - (NSArray *)supportedEvents @@ -113,9 +109,6 @@ -(void)EVENT : (NSNotification *)notification static NSDictionary *RCTParseKeyboardNotification(NSNotification *notification) { -#if TARGET_OS_TV - return @{}; -#else NSDictionary *userInfo = notification.userInfo; CGRect beginFrame = [userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue]; CGRect endFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; @@ -131,7 +124,6 @@ -(void)EVENT : (NSNotification *)notification @"easing" : RCTAnimationNameForCurve(curve), @"isEventFromThisApp" : isLocalUserInfoKey == 1 ? @YES : @NO, }; -#endif } Class RCTKeyboardObserverCls(void) diff --git a/React/CoreModules/RCTRedBox.mm b/React/CoreModules/RCTRedBox.mm index 4325dc139eca47..9fec829b0157e2 100644 --- a/React/CoreModules/RCTRedBox.mm +++ b/React/CoreModules/RCTRedBox.mm @@ -104,10 +104,8 @@ - (instancetype)initWithFrame:(CGRect)frame _stackTraceTableView.delegate = self; _stackTraceTableView.dataSource = self; _stackTraceTableView.backgroundColor = [UIColor clearColor]; -#if !TARGET_OS_TV _stackTraceTableView.separatorColor = [UIColor colorWithWhite:1 alpha:0.3]; _stackTraceTableView.separatorStyle = UITableViewCellSeparatorStyleNone; -#endif _stackTraceTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; [rootView addSubview:_stackTraceTableView]; @@ -292,10 +290,8 @@ - (void)copyStack [fullStackTrace appendFormat:@" %@\n", [self formatFrameSource:stackFrame]]; } } -#if !TARGET_OS_TV UIPasteboard *pb = [UIPasteboard generalPasteboard]; [pb setString:fullStackTrace]; -#endif } - (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame diff --git a/React/CoreModules/RCTStatusBarManager.h b/React/CoreModules/RCTStatusBarManager.h index dead2d86a85803..db02b9176a694b 100644 --- a/React/CoreModules/RCTStatusBarManager.h +++ b/React/CoreModules/RCTStatusBarManager.h @@ -12,10 +12,8 @@ @interface RCTConvert (UIStatusBar) -#if !TARGET_OS_TV + (UIStatusBarStyle)UIStatusBarStyle:(id)json; + (UIStatusBarAnimation)UIStatusBarAnimation:(id)json; -#endif @end diff --git a/React/CoreModules/RCTStatusBarManager.mm b/React/CoreModules/RCTStatusBarManager.mm index 3e62b9df5052c7..4104a7081512c0 100644 --- a/React/CoreModules/RCTStatusBarManager.mm +++ b/React/CoreModules/RCTStatusBarManager.mm @@ -12,7 +12,6 @@ #import #import -#if !TARGET_OS_TV #import @implementation RCTConvert (UIStatusBar) @@ -58,15 +57,10 @@ + (UIStatusBarStyle)UIStatusBarStyle:(id)json RCT_DYNAMIC integerValue); @end -#endif - -#if !TARGET_OS_TV @interface RCTStatusBarManager () @end -#endif - @implementation RCTStatusBarManager static BOOL RCTViewControllerBasedStatusBarAppearance() @@ -94,8 +88,6 @@ + (BOOL)requiresMainQueueSetup return @[ @"statusBarFrameDidChange", @"statusBarFrameWillChange" ]; } -#if !TARGET_OS_TV - - (void)startObserving { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; @@ -207,8 +199,6 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification return std::make_shared(params); } -#endif // TARGET_OS_TV - @end Class RCTStatusBarManagerCls(void) diff --git a/React/CoreModules/RCTTVNavigationEventEmitter.h b/React/CoreModules/RCTTVNavigationEventEmitter.h deleted file mode 100644 index b3bf1d43bd07a3..00000000000000 --- a/React/CoreModules/RCTTVNavigationEventEmitter.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -RCT_EXTERN NSString *const RCTTVNavigationEventNotification; - -@interface RCTTVNavigationEventEmitter : RCTEventEmitter - -@end diff --git a/React/CoreModules/RCTTVNavigationEventEmitter.mm b/React/CoreModules/RCTTVNavigationEventEmitter.mm deleted file mode 100644 index 58fc1ead297cfb..00000000000000 --- a/React/CoreModules/RCTTVNavigationEventEmitter.mm +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTVNavigationEventEmitter.h" - -#import -#import "CoreModulesPlugins.h" - -NSString *const RCTTVNavigationEventNotification = @"RCTTVNavigationEventNotification"; - -static NSString *const TVNavigationEventName = @"onHWKeyEvent"; - -@interface RCTTVNavigationEventEmitter () -@end - -@implementation RCTTVNavigationEventEmitter - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (instancetype)init -{ - if (self = [super init]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleTVNavigationEventNotification:) - name:RCTTVNavigationEventNotification - object:nil]; - } - return self; -} - -- (NSArray *)supportedEvents -{ - return @[ TVNavigationEventName ]; -} - -- (void)handleTVNavigationEventNotification:(NSNotification *)notif -{ - if (self.bridge) { - [self sendEventWithName:TVNavigationEventName body:notif.object]; - } -} - -- (std::shared_ptr)getTurboModule: - (const facebook::react::ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -@end - -Class RCTTVNavigationEventEmitterCls(void) -{ - return RCTTVNavigationEventEmitter.class; -} diff --git a/React/CoreModules/React-CoreModules.podspec b/React/CoreModules/React-CoreModules.podspec index 7d5a617b28a7ee..dee7239471187d 100644 --- a/React/CoreModules/React-CoreModules.podspec +++ b/React/CoreModules/React-CoreModules.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "**/*.{c,m,mm,cpp}" diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm index d9c4fb231b2493..1d112b51c1c88f 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm @@ -24,7 +24,7 @@ - (instancetype)init _heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0]; _heightConstraint.active = YES; - if (@available(iOS 11.0, tvOS 11.0, *)) { + if (@available(iOS 11.0, *)) { [NSLayoutConstraint activateConstraints:@[ [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor], [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor], diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h index 1cd88f8aa62fff..f794b067c75443 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h @@ -15,8 +15,6 @@ @property (nonatomic, weak) id delegate; -#if !TARGET_OS_TV @property (nonatomic, assign) UIInterfaceOrientationMask supportedInterfaceOrientations; -#endif @end diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm index 95f333c2e3f7fe..54061f535d79ee 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm @@ -40,7 +40,6 @@ - (void)loadView [_touchHandler attachToView:self.view]; } -#if !TARGET_OS_TV - (UIStatusBarStyle)preferredStatusBarStyle { return [RCTSharedApplication() statusBarStyle]; @@ -89,6 +88,5 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations return _supportedInterfaceOrientations; } #endif // RCT_DEV -#endif // !TARGET_OS_TV @end diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm index b4a8b7b2f5239d..65f2f6ce266300 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm @@ -19,7 +19,6 @@ using namespace facebook::react; -#if !TARGET_OS_TV static UIInterfaceOrientationMask supportedOrientationsMask(ModalHostViewSupportedOrientationsMask mask) { UIInterfaceOrientationMask supportedOrientations = 0; @@ -54,7 +53,6 @@ static UIInterfaceOrientationMask supportedOrientationsMask(ModalHostViewSupport return supportedOrientations; } -#endif static std::tuple animationConfiguration(ModalHostViewAnimationType const animation) { diff --git a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm index c54ea89bcac19f..7623c1099f93b0 100644 --- a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm @@ -34,7 +34,7 @@ - (instancetype)initWithFrame:(CGRect)frame - (UIEdgeInsets)_safeAreaInsets { - if (@available(iOS 11.0, tvOS 11.0, *)) { + if (@available(iOS 11.0, *)) { return self.safeAreaInsets; } diff --git a/React/Modules/RCTLayoutAnimation.m b/React/Modules/RCTLayoutAnimation.m index 7ad88992d9ec87..7b702c18d80dcb 100644 --- a/React/Modules/RCTLayoutAnimation.m +++ b/React/Modules/RCTLayoutAnimation.m @@ -39,7 +39,6 @@ static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnim // `UIKeyboardWillChangeFrameNotification`s. + (void)initializeStatics { -#if !TARGET_OS_TV static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ [[NSNotificationCenter defaultCenter] addObserver:self @@ -47,15 +46,12 @@ + (void)initializeStatics name:UIKeyboardWillChangeFrameNotification object:nil]; }); -#endif } + (void)keyboardWillChangeFrame:(NSNotification *)notification { -#if !TARGET_OS_TV NSDictionary *userInfo = notification.userInfo; _currentKeyboardAnimationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]; -#endif } - (instancetype)initWithDuration:(NSTimeInterval)duration diff --git a/React/Modules/RCTRedBoxExtraDataViewController.m b/React/Modules/RCTRedBoxExtraDataViewController.m index 240aa5e9b033ad..9b006ec68c1ef3 100644 --- a/React/Modules/RCTRedBoxExtraDataViewController.m +++ b/React/Modules/RCTRedBoxExtraDataViewController.m @@ -33,10 +33,8 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr self.keyLabel.textColor = [UIColor whiteColor]; self.keyLabel.numberOfLines = 0; -#if !TARGET_OS_TV self.keyLabel.lineBreakMode = NSLineBreakByWordWrapping; self.keyLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:12.0f]; -#endif self.valueLabel = [UILabel new]; [self.contentView addSubview:self.valueLabel]; @@ -48,10 +46,8 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr self.valueLabel.textColor = [UIColor whiteColor]; self.valueLabel.numberOfLines = 0; -#if !TARGET_OS_TV self.valueLabel.lineBreakMode = NSLineBreakByWordWrapping; self.valueLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:12.0f]; -#endif } return self; } @@ -82,9 +78,7 @@ - (instancetype)init _tableView.dataSource = self; _tableView.backgroundColor = [UIColor clearColor]; _tableView.estimatedRowHeight = 200; -#if !TARGET_OS_TV _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; -#endif _tableView.rowHeight = UITableViewAutomaticDimension; _tableView.allowsSelection = NO; diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 2079bbb7f6c215..8f43fd3f3b1c04 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -179,12 +179,10 @@ - (void)setBridge:(RCTBridge *)bridge object:[self->_bridge moduleForName:@"AccessibilityManager" lazilyLoadIfNecessary:YES]]; }); -#if !TARGET_OS_TV [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(namedOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil]; -#endif [RCTLayoutAnimation initializeStatics]; } @@ -210,7 +208,6 @@ - (void)didReceiveNewContentSizeMultiplier }); } -#if !TARGET_OS_TV // Names and coordinate system from html5 spec: // https://developer.mozilla.org/en-US/docs/Web/API/Screen.orientation // https://developer.mozilla.org/en-US/docs/Web/API/Screen.lockOrientation @@ -262,7 +259,6 @@ - (void)namedOrientationDidChange [_bridge.eventDispatcher sendDeviceEventWithName:@"namedOrientationDidChange" body:orientationEvent]; #pragma clang diagnostic pop } -#endif - (dispatch_queue_t)methodQueue { diff --git a/React/Profiler/RCTProfile.m b/React/Profiler/RCTProfile.m index 149451ad6bfeee..233f6e767ba781 100644 --- a/React/Profiler/RCTProfile.m +++ b/React/Profiler/RCTProfile.m @@ -393,7 +393,6 @@ + (void)toggle:(UIButton *)target RCTProfileEnd(RCTProfilingBridge(), ^(NSString *result) { NSString *outFile = [NSTemporaryDirectory() stringByAppendingString:@"tmp_trace.json"]; [result writeToFile:outFile atomically:YES encoding:NSUTF8StringEncoding error:nil]; -#if !TARGET_OS_TV UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[ [NSURL fileURLWithPath:outFile] ] applicationActivities:nil]; @@ -410,7 +409,6 @@ + (void)toggle:(UIButton *)target animated:YES completion:nil]; }); -#endif }); } else { RCTProfileInit(RCTProfilingBridge()); @@ -747,7 +745,6 @@ void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data) NSString *message = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; if (message.length) { -#if !TARGET_OS_TV dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Profile" @@ -758,7 +755,6 @@ void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data) handler:nil]]; [RCTPresentedViewController() presentViewController:alertController animated:YES completion:nil]; }); -#endif } } }]; diff --git a/React/React-RCTFabric.podspec b/React/React-RCTFabric.podspec index 34d1096c413d9e..bca122846f75b0 100644 --- a/React/React-RCTFabric.podspec +++ b/React/React-RCTFabric.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}", "Tests/**/*.{mm}" diff --git a/React/Views/RCTComponentData.m b/React/Views/RCTComponentData.m index c8c893863e2b32..5a8600cf5b55ab 100644 --- a/React/Views/RCTComponentData.m +++ b/React/Views/RCTComponentData.m @@ -70,9 +70,7 @@ - (UIView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumbe UIView *view = [self.manager view]; view.reactTag = tag; view.rootTag = rootTag; -#if !TARGET_OS_TV view.multipleTouchEnabled = YES; -#endif view.userInteractionEnabled = YES; // required for touch handling view.layer.allowsGroupOpacity = YES; // required for touch handling return view; diff --git a/React/Views/RCTModalHostView.h b/React/Views/RCTModalHostView.h index 4e61886dba54ef..c54c1c69c94413 100644 --- a/React/Views/RCTModalHostView.h +++ b/React/Views/RCTModalHostView.h @@ -13,7 +13,6 @@ @class RCTBridge; @class RCTModalHostViewController; -@class RCTTVRemoteHandler; @protocol RCTModalHostViewInteractor; @@ -32,11 +31,6 @@ @property (nonatomic, copy) NSArray *supportedOrientations; @property (nonatomic, copy) RCTDirectEventBlock onOrientationChange; -#if TARGET_OS_TV -@property (nonatomic, copy) RCTDirectEventBlock onRequestClose; -@property (nonatomic, strong) RCTTVRemoteHandler *tvRemoteHandler; -#endif - - (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; @end diff --git a/React/Views/RCTModalHostView.m b/React/Views/RCTModalHostView.m index 6a153301038853..0cfa69a99aab6f 100644 --- a/React/Views/RCTModalHostView.m +++ b/React/Views/RCTModalHostView.m @@ -16,9 +16,6 @@ #import "RCTUIManager.h" #import "RCTUtils.h" #import "UIView+React.h" -#if TARGET_OS_TV -#import "RCTTVRemoteHandler.h" -#endif @implementation RCTModalHostView { __weak RCTBridge *_bridge; @@ -26,11 +23,7 @@ @implementation RCTModalHostView { RCTModalHostViewController *_modalViewController; RCTTouchHandler *_touchHandler; UIView *_reactSubview; -#if TARGET_OS_TV - UITapGestureRecognizer *_menuButtonGestureRecognizer; -#else UIInterfaceOrientation _lastKnownOrientation; -#endif } RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) @@ -45,12 +38,6 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge containerView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; _modalViewController.view = containerView; _touchHandler = [[RCTTouchHandler alloc] initWithBridge:bridge]; -#if TARGET_OS_TV - _menuButtonGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self - action:@selector(menuButtonPressed:)]; - _menuButtonGestureRecognizer.allowedPressTypes = @[ @(UIPressTypeMenu) ]; - self.tvRemoteHandler = [RCTTVRemoteHandler new]; -#endif _isPresented = NO; __weak typeof(self) weakSelf = self; @@ -62,27 +49,6 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge return self; } -#if TARGET_OS_TV -- (void)menuButtonPressed:(__unused UIGestureRecognizer *)gestureRecognizer -{ - if (_onRequestClose) { - _onRequestClose(nil); - } -} - -- (void)setOnRequestClose:(RCTDirectEventBlock)onRequestClose -{ - _onRequestClose = onRequestClose; - if (_reactSubview) { - if (_onRequestClose && _menuButtonGestureRecognizer) { - [_reactSubview addGestureRecognizer:_menuButtonGestureRecognizer]; - } else { - [_reactSubview removeGestureRecognizer:_menuButtonGestureRecognizer]; - } - } -} -#endif - - (void)notifyForBoundsChange:(CGRect)newBounds { if (_reactSubview && _isPresented) { @@ -93,7 +59,6 @@ - (void)notifyForBoundsChange:(CGRect)newBounds - (void)notifyForOrientationChange { -#if !TARGET_OS_TV if (!_onOrientationChange) { return; } @@ -110,7 +75,6 @@ - (void)notifyForOrientationChange @"orientation" : isPortrait ? @"portrait" : @"landscape", }; _onOrientationChange(eventPayload); -#endif } - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex @@ -118,16 +82,6 @@ - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex RCTAssert(_reactSubview == nil, @"Modal view can only have one subview"); [super insertReactSubview:subview atIndex:atIndex]; [_touchHandler attachToView:subview]; -#if TARGET_OS_TV - for (NSString *key in [self.tvRemoteHandler.tvRemoteGestureRecognizers allKeys]) { - if (![key isEqualToString:RCTTVRemoteEventMenu]) { - [subview addGestureRecognizer:self.tvRemoteHandler.tvRemoteGestureRecognizers[key]]; - } - } - if (_onRequestClose) { - [subview addGestureRecognizer:_menuButtonGestureRecognizer]; - } -#endif [_modalViewController.view insertSubview:subview atIndex:0]; _reactSubview = subview; @@ -139,14 +93,6 @@ - (void)removeReactSubview:(UIView *)subview // Superclass (category) removes the `subview` from actual `superview`. [super removeReactSubview:subview]; [_touchHandler detachFromView:subview]; -#if TARGET_OS_TV - if (_menuButtonGestureRecognizer) { - [subview removeGestureRecognizer:_menuButtonGestureRecognizer]; - } - for (UIGestureRecognizer *gr in self.tvRemoteHandler.tvRemoteGestureRecognizers) { - [subview removeGestureRecognizer:gr]; - } -#endif _reactSubview = nil; } @@ -176,9 +122,8 @@ - (void)didMoveToWindow if (!_isPresented && self.window) { RCTAssert(self.reactViewController, @"Can't present modal view controller without a presenting view controller"); -#if !TARGET_OS_TV _modalViewController.supportedInterfaceOrientations = [self supportedOrientationsMask]; -#endif + if ([self.animationType isEqualToString:@"fade"]) { _modalViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; } else if ([self.animationType isEqualToString:@"slide"]) { @@ -228,7 +173,6 @@ - (void)setTransparent:(BOOL)transparent transparent ? UIModalPresentationOverFullScreen : UIModalPresentationFullScreen; } -#if !TARGET_OS_TV - (UIInterfaceOrientationMask)supportedOrientationsMask { if (_supportedOrientations.count == 0) { @@ -255,6 +199,5 @@ - (UIInterfaceOrientationMask)supportedOrientationsMask } return supportedOrientations; } -#endif @end diff --git a/React/Views/RCTModalHostViewController.h b/React/Views/RCTModalHostViewController.h index 0a4a82968075c5..a3f66b6b068336 100644 --- a/React/Views/RCTModalHostViewController.h +++ b/React/Views/RCTModalHostViewController.h @@ -11,8 +11,6 @@ @property (nonatomic, copy) void (^boundsDidChangeBlock)(CGRect newBounds); -#if !TARGET_OS_TV @property (nonatomic, assign) UIInterfaceOrientationMask supportedInterfaceOrientations; -#endif @end diff --git a/React/Views/RCTModalHostViewController.m b/React/Views/RCTModalHostViewController.m index 112bc17c4d85bf..00c149d3db8474 100644 --- a/React/Views/RCTModalHostViewController.m +++ b/React/Views/RCTModalHostViewController.m @@ -12,10 +12,8 @@ @implementation RCTModalHostViewController { CGRect _lastViewFrame; -#if !TARGET_OS_TV UIStatusBarStyle _preferredStatusBarStyle; BOOL _preferredStatusBarHidden; -#endif } - (instancetype)init @@ -31,10 +29,8 @@ - (instancetype)init } #endif -#if !TARGET_OS_TV _preferredStatusBarStyle = [RCTSharedApplication() statusBarStyle]; _preferredStatusBarHidden = [RCTSharedApplication() isStatusBarHidden]; -#endif return self; } @@ -49,7 +45,6 @@ - (void)viewDidLayoutSubviews } } -#if !TARGET_OS_TV - (UIStatusBarStyle)preferredStatusBarStyle { return _preferredStatusBarStyle; @@ -78,6 +73,5 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations return _supportedInterfaceOrientations; } #endif // RCT_DEV -#endif // !TARGET_OS_TV @end diff --git a/React/Views/RCTModalHostViewManager.m b/React/Views/RCTModalHostViewManager.m index 4698139f90102b..14c220ba5b90e9 100644 --- a/React/Views/RCTModalHostViewManager.m +++ b/React/Views/RCTModalHostViewManager.m @@ -19,10 +19,8 @@ @implementation RCTConvert (RCTModalHostView) UIModalPresentationStyle, (@{ @"fullScreen" : @(UIModalPresentationFullScreen), -#if !TARGET_OS_TV @"pageSheet" : @(UIModalPresentationPageSheet), @"formSheet" : @(UIModalPresentationFormSheet), -#endif @"overFullScreen" : @(UIModalPresentationOverFullScreen), }), UIModalPresentationFullScreen, @@ -132,8 +130,4 @@ - (void)invalidate RCT_EXPORT_VIEW_PROPERTY(supportedOrientations, NSArray) RCT_EXPORT_VIEW_PROPERTY(onOrientationChange, RCTDirectEventBlock) -#if TARGET_OS_TV -RCT_EXPORT_VIEW_PROPERTY(onRequestClose, RCTDirectEventBlock) -#endif - @end diff --git a/React/Views/RCTProgressViewManager.m b/React/Views/RCTProgressViewManager.m index 887473cb1aa73b..ed434250101f58 100644 --- a/React/Views/RCTProgressViewManager.m +++ b/React/Views/RCTProgressViewManager.m @@ -15,9 +15,7 @@ @implementation RCTConvert (RCTProgressViewManager) UIProgressViewStyle, (@{ @"default" : @(UIProgressViewStyleDefault), -#if !TARGET_OS_TV @"bar" : @(UIProgressViewStyleBar), -#endif }), UIProgressViewStyleDefault, integerValue) diff --git a/React/Views/RCTTVView.h b/React/Views/RCTTVView.h deleted file mode 100644 index a421e6fc61f173..00000000000000 --- a/React/Views/RCTTVView.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import - -// A RCTView with additional properties and methods for user interaction using the Apple TV focus engine. -@interface RCTTVView : RCTView - -/** - * TV event handlers - */ -@property (nonatomic, assign) BOOL isTVSelectable; // True if this view is TV-focusable - -/** - * Properties for Apple TV focus parallax effects - */ -@property (nonatomic, copy) NSDictionary *tvParallaxProperties; - -/** - * TV preferred focus - */ -@property (nonatomic, assign) BOOL hasTVPreferredFocus; - -@end diff --git a/React/Views/RCTTVView.m b/React/Views/RCTTVView.m deleted file mode 100644 index 6f06b9a1f411d2..00000000000000 --- a/React/Views/RCTTVView.m +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTVView.h" - -#import "RCTAutoInsetsProtocol.h" -#import "RCTBorderDrawing.h" -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTRootViewInternal.h" -#import "RCTTVNavigationEventEmitter.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" - -@implementation RCTTVView { - UITapGestureRecognizer *_selectRecognizer; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - dispatch_once(&onceToken, ^{ - defaultTVParallaxProperties = @{ - @"enabled" : @YES, - @"shiftDistanceX" : @2.0f, - @"shiftDistanceY" : @2.0f, - @"tiltAngle" : @0.05f, - @"magnification" : @1.0f, - @"pressMagnification" : @1.0f, - @"pressDuration" : @0.3f, - @"pressDelay" : @0.0f - }; - }); - self.tvParallaxProperties = defaultTVParallaxProperties; - } - - return self; -} - -static NSDictionary *defaultTVParallaxProperties = nil; -static dispatch_once_t onceToken; - -- (void)setTvParallaxProperties:(NSDictionary *)tvParallaxProperties -{ - if (_tvParallaxProperties == nil) { - _tvParallaxProperties = [defaultTVParallaxProperties copy]; - return; - } - - NSMutableDictionary *newParallaxProperties = [NSMutableDictionary dictionaryWithDictionary:_tvParallaxProperties]; - for (NSString *k in [defaultTVParallaxProperties allKeys]) { - if (tvParallaxProperties[k]) { - newParallaxProperties[k] = tvParallaxProperties[k]; - } - } - _tvParallaxProperties = [newParallaxProperties copy]; -} - -RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused) - -- (void)setIsTVSelectable:(BOOL)isTVSelectable -{ - self->_isTVSelectable = isTVSelectable; - if (isTVSelectable) { - UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self - action:@selector(handleSelect:)]; - recognizer.allowedPressTypes = @[ @(UIPressTypeSelect) ]; - _selectRecognizer = recognizer; - [self addGestureRecognizer:_selectRecognizer]; - } else { - if (_selectRecognizer) { - [self removeGestureRecognizer:_selectRecognizer]; - } - } -} - -- (void)handleSelect:(__unused UIGestureRecognizer *)r -{ - if ([self.tvParallaxProperties[@"enabled"] boolValue] == YES) { - float magnification = [self.tvParallaxProperties[@"magnification"] floatValue]; - float pressMagnification = [self.tvParallaxProperties[@"pressMagnification"] floatValue]; - - // Duration of press animation - float pressDuration = [self.tvParallaxProperties[@"pressDuration"] floatValue]; - - // Delay of press animation - float pressDelay = [self.tvParallaxProperties[@"pressDelay"] floatValue]; - - [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:pressDelay]]; - - [UIView animateWithDuration:(pressDuration / 2) - animations:^{ - self.transform = CGAffineTransformMakeScale(pressMagnification, pressMagnification); - } - completion:^(__unused BOOL finished1) { - [UIView animateWithDuration:(pressDuration / 2) - animations:^{ - self.transform = CGAffineTransformMakeScale(magnification, magnification); - } - completion:^(__unused BOOL finished2) { - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType" : @"select", @"tag" : self.reactTag}]; - }]; - }]; - - } else { - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType" : @"select", @"tag" : self.reactTag}]; - } -} - -- (BOOL)isUserInteractionEnabled -{ - return YES; -} - -- (BOOL)canBecomeFocused -{ - return (self.isTVSelectable); -} - -- (void)addParallaxMotionEffects -{ - // Size of shift movements - CGFloat const shiftDistanceX = [self.tvParallaxProperties[@"shiftDistanceX"] floatValue]; - CGFloat const shiftDistanceY = [self.tvParallaxProperties[@"shiftDistanceY"] floatValue]; - - // Make horizontal movements shift the centre left and right - UIInterpolatingMotionEffect *xShift = - [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" - type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; - xShift.minimumRelativeValue = @(shiftDistanceX * -1.0f); - xShift.maximumRelativeValue = @(shiftDistanceX); - - // Make vertical movements shift the centre up and down - UIInterpolatingMotionEffect *yShift = - [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" - type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; - yShift.minimumRelativeValue = @(shiftDistanceY * -1.0f); - yShift.maximumRelativeValue = @(shiftDistanceY); - - // Size of tilt movements - CGFloat const tiltAngle = [self.tvParallaxProperties[@"tiltAngle"] floatValue]; - - // Now make horizontal movements effect a rotation about the Y axis for side-to-side rotation. - UIInterpolatingMotionEffect *xTilt = - [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"layer.transform" - type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; - - // CATransform3D value for minimumRelativeValue - CATransform3D transMinimumTiltAboutY = CATransform3DIdentity; - transMinimumTiltAboutY.m34 = 1.0 / 500; - transMinimumTiltAboutY = CATransform3DRotate(transMinimumTiltAboutY, tiltAngle * -1.0, 0, 1, 0); - - // CATransform3D value for minimumRelativeValue - CATransform3D transMaximumTiltAboutY = CATransform3DIdentity; - transMaximumTiltAboutY.m34 = 1.0 / 500; - transMaximumTiltAboutY = CATransform3DRotate(transMaximumTiltAboutY, tiltAngle, 0, 1, 0); - - // Set the transform property boundaries for the interpolation - xTilt.minimumRelativeValue = [NSValue valueWithCATransform3D:transMinimumTiltAboutY]; - xTilt.maximumRelativeValue = [NSValue valueWithCATransform3D:transMaximumTiltAboutY]; - - // Now make vertical movements effect a rotation about the X axis for up and down rotation. - UIInterpolatingMotionEffect *yTilt = - [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"layer.transform" - type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; - - // CATransform3D value for minimumRelativeValue - CATransform3D transMinimumTiltAboutX = CATransform3DIdentity; - transMinimumTiltAboutX.m34 = 1.0 / 500; - transMinimumTiltAboutX = CATransform3DRotate(transMinimumTiltAboutX, tiltAngle * -1.0, 1, 0, 0); - - // CATransform3D value for minimumRelativeValue - CATransform3D transMaximumTiltAboutX = CATransform3DIdentity; - transMaximumTiltAboutX.m34 = 1.0 / 500; - transMaximumTiltAboutX = CATransform3DRotate(transMaximumTiltAboutX, tiltAngle, 1, 0, 0); - - // Set the transform property boundaries for the interpolation - yTilt.minimumRelativeValue = [NSValue valueWithCATransform3D:transMinimumTiltAboutX]; - yTilt.maximumRelativeValue = [NSValue valueWithCATransform3D:transMaximumTiltAboutX]; - - // Add all of the motion effects to this group - self.motionEffects = @[ xShift, yShift, xTilt, yTilt ]; - - float magnification = [self.tvParallaxProperties[@"magnification"] floatValue]; - - [UIView animateWithDuration:0.2 - animations:^{ - self.transform = CGAffineTransformMakeScale(magnification, magnification); - }]; -} - -- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context - withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator -{ - if (context.nextFocusedView == self && self.isTVSelectable) { - [self becomeFirstResponder]; - [coordinator - addCoordinatedAnimations:^(void) { - if ([self.tvParallaxProperties[@"enabled"] boolValue]) { - [self addParallaxMotionEffects]; - } - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType" : @"focus", @"tag" : self.reactTag}]; - } - completion:^(void){ - }]; - } else { - [coordinator - addCoordinatedAnimations:^(void) { - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType" : @"blur", @"tag" : self.reactTag}]; - [UIView animateWithDuration:0.2 - animations:^{ - self.transform = CGAffineTransformMakeScale(1, 1); - }]; - - for (UIMotionEffect *effect in [self.motionEffects copy]) { - [self removeMotionEffect:effect]; - } - } - completion:^(void){ - }]; - [self resignFirstResponder]; - } -} - -- (void)setHasTVPreferredFocus:(BOOL)hasTVPreferredFocus -{ - _hasTVPreferredFocus = hasTVPreferredFocus; - if (hasTVPreferredFocus) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - UIView *rootview = self; - while (![rootview isReactRootView] && rootview != nil) { - rootview = [rootview superview]; - } - if (rootview == nil) - return; - - rootview = [rootview superview]; - - [rootview setNeedsFocusUpdate]; - [rootview updateFocusIfNeeded]; - }); - } -} - -@end diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index 8b948eb5eb9ab8..ee6c41fee1cc2b 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -20,10 +20,6 @@ #import "RCTView.h" #import "UIView+React.h" -#if TARGET_OS_TV -#import "RCTTVView.h" -#endif - @implementation RCTConvert (UIAccessibilityTraits) RCT_MULTI_ENUM_CONVERTER( @@ -83,11 +79,7 @@ - (dispatch_queue_t)methodQueue - (UIView *)view { -#if TARGET_OS_TV - return [RCTTVView new]; -#else return [RCTView new]; -#endif } - (RCTShadowView *)shadowView @@ -118,13 +110,6 @@ - (RCTShadowView *)shadowView #pragma mark - View properties -#if TARGET_OS_TV -// TODO: Delete props for Apple TV. -RCT_EXPORT_VIEW_PROPERTY(isTVSelectable, BOOL) -RCT_EXPORT_VIEW_PROPERTY(hasTVPreferredFocus, BOOL) -RCT_EXPORT_VIEW_PROPERTY(tvParallaxProperties, NSDictionary) -#endif - // Accessibility related properties RCT_REMAP_VIEW_PROPERTY(accessible, reactAccessibilityElement.isAccessibilityElement, BOOL) RCT_REMAP_VIEW_PROPERTY(accessibilityActions, reactAccessibilityElement.accessibilityActions, NSDictionaryArray) diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index 7e341219a63984..8bdb3bb461d267 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -11,6 +11,7 @@ #import "RCTConvert.h" #import "RCTLog.h" +#import "RCTRefreshControl.h" #import "RCTScrollEvent.h" #import "RCTUIManager.h" #import "RCTUIManagerObserverCoordinator.h" @@ -19,10 +20,6 @@ #import "UIView+Private.h" #import "UIView+React.h" -#if !TARGET_OS_TV -#import "RCTRefreshControl.h" -#endif - /** * Include a custom scroll view subclass because we want to limit certain * default UIKit behaviors such as textFields automatically scrolling @@ -31,10 +28,8 @@ @interface RCTCustomScrollView : UIScrollView @property (nonatomic, assign) BOOL centerContent; -#if !TARGET_OS_TV @property (nonatomic, strong) UIView *customRefreshControl; @property (nonatomic, assign) BOOL pinchGestureEnabled; -#endif @end @@ -52,9 +47,7 @@ - (instancetype)initWithFrame:(CGRect)frame self.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; } -#if !TARGET_OS_TV _pinchGestureEnabled = YES; -#endif } return self; } @@ -223,7 +216,6 @@ - (void)setFrame:(CGRect)frame } } -#if !TARGET_OS_TV - (void)setCustomRefreshControl:(UIView *)refreshControl { if (_customRefreshControl) { @@ -256,7 +248,6 @@ - (void)didMoveToWindow // in the setter gets overridden when the view loads. self.pinchGestureRecognizer.enabled = _pinchGestureEnabled; } -#endif // TARGET_OS_TV - (BOOL)shouldGroupAccessibilityChildren { @@ -351,15 +342,12 @@ - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex { [super insertReactSubview:view atIndex:atIndex]; -#if !TARGET_OS_TV if ([view conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { [_scrollView setCustomRefreshControl:(UIView *)view]; if (![view isKindOfClass:[UIRefreshControl class]] && [view conformsToProtocol:@protocol(UIScrollViewDelegate)]) { [self addScrollListener:(UIView *)view]; } - } else -#endif - { + } else { RCTAssert( _contentView == nil, @"RCTScrollView may only contain a single subview, the already set subview looks like: %@", @@ -373,16 +361,13 @@ - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex - (void)removeReactSubview:(UIView *)subview { [super removeReactSubview:subview]; -#if !TARGET_OS_TV if ([subview conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { [_scrollView setCustomRefreshControl:nil]; if (![subview isKindOfClass:[UIRefreshControl class]] && [subview conformsToProtocol:@protocol(UIScrollViewDelegate)]) { [self removeScrollListener:(UIView *)subview]; } - } else -#endif - { + } else { RCTAssert(_contentView == subview, @"Attempted to remove non-existent subview"); _contentView = nil; } @@ -994,10 +979,8 @@ -(type)getter \ RCT_SET_AND_PRESERVE_OFFSET(setMaximumZoomScale, maximumZoomScale, CGFloat) RCT_SET_AND_PRESERVE_OFFSET(setMinimumZoomScale, minimumZoomScale, CGFloat) RCT_SET_AND_PRESERVE_OFFSET(setScrollEnabled, isScrollEnabled, BOOL) -#if !TARGET_OS_TV RCT_SET_AND_PRESERVE_OFFSET(setPagingEnabled, isPagingEnabled, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setScrollsToTop, scrollsToTop, BOOL) -#endif RCT_SET_AND_PRESERVE_OFFSET(setShowsHorizontalScrollIndicator, showsHorizontalScrollIndicator, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); diff --git a/React/Views/ScrollView/RCTScrollViewManager.m b/React/Views/ScrollView/RCTScrollViewManager.m index a176d1068609ba..086a05450cbd6d 100644 --- a/React/Views/ScrollView/RCTScrollViewManager.m +++ b/React/Views/ScrollView/RCTScrollViewManager.m @@ -78,11 +78,9 @@ - (UIView *)view RCT_EXPORT_VIEW_PROPERTY(maximumZoomScale, CGFloat) RCT_EXPORT_VIEW_PROPERTY(minimumZoomScale, CGFloat) RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) -#if !TARGET_OS_TV RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL) RCT_REMAP_VIEW_PROPERTY(pinchGestureEnabled, scrollView.pinchGestureEnabled, BOOL) RCT_EXPORT_VIEW_PROPERTY(scrollsToTop, BOOL) -#endif RCT_EXPORT_VIEW_PROPERTY(showsHorizontalScrollIndicator, BOOL) RCT_EXPORT_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL) RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval) diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index 1937e45d71b0b6..0bf38ed0c2f62a 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.prepare_command = File.read("../scripts/generate-rncore.sh") s.source_files = "dummyFile.cpp" diff --git a/ReactCommon/ReactCommon.podspec b/ReactCommon/ReactCommon.podspec index 0e306074b6239c..0c083cf2d5b133 100644 --- a/ReactCommon/ReactCommon.podspec +++ b/ReactCommon/ReactCommon.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.header_dir = "ReactCommon" # Use global header_dir for all subspecs for use_frameworks! compatibility s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags diff --git a/ReactCommon/callinvoker/React-callinvoker.podspec b/ReactCommon/callinvoker/React-callinvoker.podspec index e2a90d30943353..76aec146d61cdb 100644 --- a/ReactCommon/callinvoker/React-callinvoker.podspec +++ b/ReactCommon/callinvoker/React-callinvoker.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{cpp,h}" s.header_dir = "ReactCommon" diff --git a/ReactCommon/jsi/React-jsi.podspec b/ReactCommon/jsi/React-jsi.podspec index 01035d5667e3e4..d250597b12721f 100644 --- a/ReactCommon/jsi/React-jsi.podspec +++ b/ReactCommon/jsi/React-jsi.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{cpp,h}" s.exclude_files = "**/test/*" diff --git a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec index f67143d1b0c91d..45429c92bf325d 100644 --- a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +++ b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "jsireact/*.{cpp,h}" s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags diff --git a/ReactCommon/jsinspector/React-jsinspector.podspec b/ReactCommon/jsinspector/React-jsinspector.podspec index 600480fe8e20cd..f87cdeefe3aed5 100644 --- a/ReactCommon/jsinspector/React-jsinspector.podspec +++ b/ReactCommon/jsinspector/React-jsinspector.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "*.{cpp,h}" s.header_dir = 'jsinspector' diff --git a/ReactCommon/reactperflogger/React-perflogger.podspec b/ReactCommon/reactperflogger/React-perflogger.podspec index 43d795d08e3ad0..b620cbf0e270bb 100644 --- a/ReactCommon/reactperflogger/React-perflogger.podspec +++ b/ReactCommon/reactperflogger/React-perflogger.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{cpp,h}" s.header_dir = "reactperflogger" diff --git a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec index e7fc8d2d2a3319..152c1f639b205c 100644 --- a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +++ b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0" } + s.platforms = { :ios => "10.0" } s.source = source s.source_files = "**/*.{cpp,h}" s.header_dir = "ReactCommon" diff --git a/ReactCommon/yoga/Yoga.podspec b/ReactCommon/yoga/Yoga.podspec index b0a69cbb9b603a..500dfee8e47ac5 100644 --- a/ReactCommon/yoga/Yoga.podspec +++ b/ReactCommon/yoga/Yoga.podspec @@ -43,7 +43,7 @@ Pod::Spec.new do |spec| ] # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "10.0", :tvos => "10.0" } + spec.platforms = { :ios => "10.0" } # Set this environment variable when *not* using the `:path` option to install the pod. # E.g. when publishing this spec to a spec repo. diff --git a/index.js b/index.js index 63c1d5f96fd29f..581c1a9522fb38 100644 --- a/index.js +++ b/index.js @@ -80,7 +80,6 @@ import typeof StyleSheet from './Libraries/StyleSheet/StyleSheet'; import typeof Systrace from './Libraries/Performance/Systrace'; import typeof ToastAndroid from './Libraries/Components/ToastAndroid/ToastAndroid'; import typeof * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistry'; -import typeof TVEventHandler from './Libraries/Components/AppleTV/TVEventHandler'; import typeof UIManager from './Libraries/ReactNative/UIManager'; import typeof useColorScheme from './Libraries/Utilities/useColorScheme'; import typeof useWindowDimensions from './Libraries/Utilities/useWindowDimensions'; @@ -417,9 +416,6 @@ module.exports = { get TurboModuleRegistry(): TurboModuleRegistry { return require('./Libraries/TurboModule/TurboModuleRegistry'); }, - get TVEventHandler(): TVEventHandler { - return require('./Libraries/Components/AppleTV/TVEventHandler'); - }, get UIManager(): UIManager { return require('./Libraries/ReactNative/UIManager'); }, diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index feb55d5dbc64aa..0ea79d0fad55c3 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -489,8 +489,8 @@ SPEC CHECKSUMS: CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845 CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f DoubleConversion: cde416483dac037923206447da6e1454df403714 - FBLazyVector: 8ea0285646adaf7fa725c20ed737c49ee5ea680a - FBReactNativeSpec: 29b1b8a11346e71351f3a2ba126439810edee362 + FBLazyVector: fe973c09b2299b5e8154186ecf1f6554b4f70987 + FBReactNativeSpec: 20a9345af9157362b51ab0258d842cb7bb347d19 Flipper: be611d4b742d8c87fbae2ca5f44603a02539e365 Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41 Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3 @@ -501,31 +501,31 @@ SPEC CHECKSUMS: glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 RCT-Folly: b39288cedafe50da43317ec7d91bcc8cc0abbf33 - RCTRequired: 34582e9b3ebe69f244e091f37218d318406d5c4a - RCTTypeSafety: 84db212a990ce622a28f1bcb1ac68c658e722373 - React: cafb3c2321f7df55ce90dbf29d513799a79e4418 - React-callinvoker: 0dada022d38b73e6e15b33e2a96476153f79bbf6 - React-Core: fbbfaa3cbb1ca720fd74ef938214b5943da1aa5d - React-CoreModules: f38b671f8df4c1c744ed69f00264539a7c4024b4 + RCTRequired: d3d4ce60e1e2282864d7560340690a3c8c646de1 + RCTTypeSafety: 4da4f9f218727257c50fd3bf2683a06cdb4fede3 + React: 87b3271d925336a94620915db5845c67c5dbbd77 + React-callinvoker: e9524d75cf0b7ae108868f8d34c0b8d7dc08ec03 + React-Core: f4eeb7ca3d6a7c2879d1d5b093800f23da9be617 + React-CoreModules: 87f011fa87190ffe979e443ce578ec93ec6ff4d4 React-cxxreact: de6de17eac6bbaa4f9fad46b66e7f0c4aaaf863d - React-jsi: 652ad7cb7ff8c87e0e9fb11e9ebcbbc70cdfe865 - React-jsiexecutor: f20d2b5986dbe3d0e94ccbf2d8da24e0d9c42cc9 - React-jsinspector: 7fbf9b42b58b02943a0d89b0ba9fff0070f2de98 - React-perflogger: 1f668f3e4d1adef1fafb3b95e7d6cf922113fe31 - React-RCTActionSheet: 51c43beeb74ef41189e87fe9823e53ebf6210359 - React-RCTAnimation: 62f271148b71d0200773b4959e99a80f624182d4 - React-RCTBlob: e3e60611af4a077b3c0a3f74f49a2c4a9a298da3 - React-RCTImage: 37646ebc761e9f68781867e9e802afdadd18a3dc - React-RCTLinking: b5c261eb3befe7d5c62a4706ae904943e73f9c82 - React-RCTNetwork: 2f6c4ba283c9c2ea768fecc6c681d3ab9448b5f5 - React-RCTPushNotification: a4f86ef3d7c0cb3ee570108a62e39fcd296a5030 - React-RCTSettings: 5a76683d9cf7408b5f8c3306cda3eaf4db191fce + React-jsi: 790da16b69a61adc36829eed43c44187c1488d10 + React-jsiexecutor: 17a3e26806bc19d8be7b6c83792bffc46df796be + React-jsinspector: 01db8cd098c7ab72bd09abdda522a08c9acd3af9 + React-perflogger: 37913fce32026582ad0244b585d1e52652fd01c0 + React-RCTActionSheet: e6562ea4df7099af4023d1bd0e9716e43b45a5c9 + React-RCTAnimation: fc2f655a64f0791879ab03843cca90c53737d1cb + React-RCTBlob: 5f82467e5d3bef65d05cdd900df6e12b0849744a + React-RCTImage: f3a98834281555ce1bbbe1af0306aaf40ac70fc7 + React-RCTLinking: 801d05ad5e6d1636e977f4dfeab21f87358a02a5 + React-RCTNetwork: b5e2f27a098ca52d98426328640314a499da6d00 + React-RCTPushNotification: ce60993f816f917a6495227e16978b5fd550d73b + React-RCTSettings: 3cb638230af06ba769edc0bc4ed4123040b1b4e2 React-RCTTest: 090e9816044220c39462be109dab6d473d94b1c9 - React-RCTText: 6c01963d3e562109f5548262b09b1b2bc260dd60 - React-RCTVibration: 0997fcaf753c7ac0a341177db120eebc438484cf - React-runtimeexecutor: 60dd6204a13f68a1aa1118870edcc604a791df2b - ReactCommon: e74025a9d02a02150f065719e14a8cbe03a93513 - Yoga: f7fa200d8c49f97b54c9421079e781fb900b5cae + React-RCTText: 51a41bf9d18a91b2437b833ed4246754baf830d0 + React-RCTVibration: a1cce36dd452eb88296d99d80d66f2c5bd50aad4 + React-runtimeexecutor: 53867815d0a01e53a2c901cb7f01076216c5c799 + ReactCommon: dc40b68c9a72e99e07f831b0e87a859f4660208b + Yoga: 69ef0b2bba5387523f793957a9f80dbd61e89631 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a PODFILE CHECKSUM: c38c19657f5aaa2d604f5f4c607f030b60452997 diff --git a/packages/rn-tester/js/examples/TVEventHandler/TVEventHandlerExample.js b/packages/rn-tester/js/examples/TVEventHandler/TVEventHandlerExample.js deleted file mode 100644 index 26aff1bfc30ef2..00000000000000 --- a/packages/rn-tester/js/examples/TVEventHandler/TVEventHandlerExample.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const React = require('react'); -const ReactNative = require('react-native'); - -const {Platform, View, Text, TouchableOpacity, TVEventHandler} = ReactNative; - -type Props = $ReadOnly<{||}>; -type State = {|lastEventType: string|}; -class TVEventHandlerView extends React.Component { - constructor(props: Props) { - super(props); - this.state = { - lastEventType: '', - }; - } - - _tvEventHandler: any; - - _enableTVEventHandler() { - this._tvEventHandler = new TVEventHandler(); - this._tvEventHandler.enable(this, function(cmp, evt) { - cmp.setState({ - lastEventType: evt.eventType, - }); - }); - } - - _disableTVEventHandler() { - if (this._tvEventHandler) { - this._tvEventHandler.disable(); - delete this._tvEventHandler; - } - } - - componentDidMount() { - this._enableTVEventHandler(); - } - - componentWillUnmount() { - this._disableTVEventHandler(); - } - - render() { - if (Platform.isTV) { - return ( - - {}}> - - This example enables an instance of TVEventHandler to show the - last event detected from the Apple TV Siri remote or from a - keyboard. - - - {this.state.lastEventType} - - ); - } else { - return ( - - This example is intended to be run on Apple TV. - - ); - } - } -} - -exports.framework = 'React'; -exports.title = 'TVEventHandler example'; -exports.category = 'iOS'; -exports.description = 'iOS alerts and action sheets'; -exports.examples = [ - { - title: 'TVEventHandler', - render(): React.Node { - return ; - }, - }, -]; diff --git a/packages/rn-tester/js/utils/RNTesterList.ios.js b/packages/rn-tester/js/utils/RNTesterList.ios.js index f0e96e4b005734..1c23b3aec4e028 100644 --- a/packages/rn-tester/js/utils/RNTesterList.ios.js +++ b/packages/rn-tester/js/utils/RNTesterList.ios.js @@ -293,11 +293,6 @@ const APIExamples: Array = [ module: require('../examples/TurboModule/TurboModuleExample'), supportsTVOS: false, }, - { - key: 'TVEventHandlerExample', - module: require('../examples/TVEventHandler/TVEventHandlerExample'), - supportsTVOS: true, - }, { key: 'VibrationExample', module: require('../examples/Vibration/VibrationExample'), diff --git a/scripts/.tests.env b/scripts/.tests.env index 0d9a9376dda3de..831e4ff0b8426d 100644 --- a/scripts/.tests.env +++ b/scripts/.tests.env @@ -19,7 +19,6 @@ export AVD_ABI=x86 ## IOS ## export IOS_TARGET_OS="13.6" export IOS_DEVICE="iPhone 8" -export TVOS_DEVICE="Apple TV" export SDK_IOS="iphonesimulator" ## CI OVERRIDES ## diff --git a/scripts/ios-configure-glog.sh b/scripts/ios-configure-glog.sh index 73a892c9a85c15..f527702bbd03c9 100755 --- a/scripts/ios-configure-glog.sh +++ b/scripts/ios-configure-glog.sh @@ -30,22 +30,12 @@ fi ./configure --host arm-apple-darwin -# Fix build for tvOS -cat << EOF >> src/config.h - /* Add in so we have Apple Target Conditionals */ #ifdef __APPLE__ #include #include #endif -/* Special configuration for AppleTVOS */ -#if TARGET_OS_TV -#undef HAVE_SYSCALL_H -#undef HAVE_SYS_SYSCALL_H -#undef OS_MACOSX -#endif - /* Special configuration for ucontext */ #undef HAVE_UCONTEXT_H #undef PC_FROM_UCONTEXT diff --git a/template/ios/HelloWorld.xcodeproj/project.pbxproj b/template/ios/HelloWorld.xcodeproj/project.pbxproj index 0a340e5af348ee..217779569f5da2 100644 --- a/template/ios/HelloWorld.xcodeproj/project.pbxproj +++ b/template/ios/HelloWorld.xcodeproj/project.pbxproj @@ -37,7 +37,6 @@ 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = HelloWorld/main.m; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = HelloWorld/LaunchScreen.storyboard; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ diff --git a/third-party-podspecs/DoubleConversion.podspec b/third-party-podspecs/DoubleConversion.podspec index fb337a96f70648..b84ba28a6b143e 100644 --- a/third-party-podspecs/DoubleConversion.podspec +++ b/third-party-podspecs/DoubleConversion.podspec @@ -19,6 +19,6 @@ Pod::Spec.new do |spec| spec.compiler_flags = '-Wno-unreachable-code' # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "10.0", :tvos => "10.0" } + spec.platforms = { :ios => "10.0" } end diff --git a/third-party-podspecs/glog.podspec b/third-party-podspecs/glog.podspec index b5f29e538d0eab..4a931f46a0cfa8 100644 --- a/third-party-podspecs/glog.podspec +++ b/third-party-podspecs/glog.podspec @@ -34,6 +34,6 @@ Pod::Spec.new do |spec| "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/src" } # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "10.0", :tvos => "10.0" } + spec.platforms = { :ios => "10.0" } end