Skip to content

Commit 2160377

Browse files
Simekfacebook-github-bot
authored andcommitted
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), #28706, #28743, #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 <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/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: #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
1 parent 06ce643 commit 2160377

File tree

93 files changed

+87
-1463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+87
-1463
lines changed

.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ while :; do
6767
shift
6868
;;
6969

70-
--tvos)
71-
RUN_IOS=1
72-
shift
73-
;;
74-
7570
*)
7671
break
7772
esac

Libraries/ActionSheetIOS/React-RCTActionSheet.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ Pod::Spec.new do |s|
2424
s.documentation_url = "https://reactnative.dev/docs/actionsheetios"
2525
s.license = package["license"]
2626
s.author = "Facebook, Inc. and its affiliates"
27-
s.platforms = { :ios => "10.0", :tvos => "10.0" }
27+
s.platforms = { :ios => "10.0" }
2828
s.source = source
2929
s.source_files = "*.{m}"
30-
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
30+
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
3131
s.header_dir = "RCTActionSheet"
3232

3333
s.dependency "React-Core/RCTActionSheetHeaders", version

Libraries/Blob/React-RCTBlob.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
2626
s.homepage = "https://reactnative.dev/"
2727
s.license = package["license"]
2828
s.author = "Facebook, Inc. and its affiliates"
29-
s.platforms = { :ios => "10.0", :tvos => "10.0" }
29+
s.platforms = { :ios => "10.0" }
3030
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
3131
s.source = source
3232
s.source_files = "*.{h,m,mm}"

Libraries/Components/AppleTV/TVEventHandler.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

Libraries/Components/ScrollView/ScrollView.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,13 +1206,12 @@ class ScrollView extends React.Component<Props, State> {
12061206
if (refreshControl) {
12071207
if (Platform.OS === 'ios') {
12081208
// On iOS the RefreshControl is a child of the ScrollView.
1209-
// tvOS lacks native support for RefreshControl, so don't include it in that case
12101209
return (
12111210
/* $FlowFixMe(>=0.117.0 site=react_native_fb) This comment suppresses
12121211
* an error found when Flow v0.117 was deployed. To see the error,
12131212
* delete this comment and run Flow. */
12141213
<ScrollViewClass {...props} ref={this._setNativeRef}>
1215-
{Platform.isTV ? null : refreshControl}
1214+
{refreshControl}
12161215
{contentContainer}
12171216
</ScrollViewClass>
12181217
);

Libraries/Components/Touchable/TVTouchable.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

Libraries/Components/Touchable/Touchable.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const Position = require('./Position');
1616
const React = require('react');
1717
const ReactNative = require('../../Renderer/shims/ReactNative');
1818
const StyleSheet = require('../../StyleSheet/StyleSheet');
19-
const TVEventHandler = require('../AppleTV/TVEventHandler');
2019
const UIManager = require('../../ReactNative/UIManager');
2120
const View = require('../View/View');
2221
const SoundManager = require('../Sound/SoundManager');
@@ -370,33 +369,12 @@ const TouchableMixin = {
370369
if (!Platform.isTV) {
371370
return;
372371
}
373-
374-
this._tvEventHandler = new TVEventHandler();
375-
this._tvEventHandler.enable(this, function(cmp, evt) {
376-
const myTag = ReactNative.findNodeHandle(cmp);
377-
evt.dispatchConfig = {};
378-
if (myTag === evt.tag) {
379-
if (evt.eventType === 'focus') {
380-
cmp.touchableHandleFocus(evt);
381-
} else if (evt.eventType === 'blur') {
382-
cmp.touchableHandleBlur(evt);
383-
} else if (evt.eventType === 'select' && Platform.OS !== 'android') {
384-
cmp.touchableHandlePress &&
385-
!cmp.props.disabled &&
386-
cmp.touchableHandlePress(evt);
387-
}
388-
}
389-
});
390372
},
391373

392374
/**
393375
* Clear all timeouts on unmount
394376
*/
395377
componentWillUnmount: function() {
396-
if (this._tvEventHandler) {
397-
this._tvEventHandler.disable();
398-
delete this._tvEventHandler;
399-
}
400378
this.touchableDelayTimeout && clearTimeout(this.touchableDelayTimeout);
401379
this.longPressDelayTimeout && clearTimeout(this.longPressDelayTimeout);
402380
this.pressOutDelayTimeout && clearTimeout(this.pressOutDelayTimeout);

Libraries/Components/Touchable/TouchableBounce.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import Pressability, {
1515
} from '../../Pressability/Pressability';
1616
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
1717
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
18-
import TVTouchable from './TVTouchable';
1918
import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
2019
import {Animated, Platform} from 'react-native';
2120
import * as React from 'react';
@@ -38,8 +37,6 @@ type State = $ReadOnly<{|
3837
|}>;
3938

4039
class TouchableBounce extends React.Component<Props, State> {
41-
_tvTouchable: ?TVTouchable;
42-
4340
state: State = {
4441
pressability: new Pressability(this._createPressabilityConfig()),
4542
scale: new Animated.Value(1),
@@ -172,39 +169,11 @@ class TouchableBounce extends React.Component<Props, State> {
172169
);
173170
}
174171

175-
componentDidMount(): void {
176-
if (Platform.isTV) {
177-
this._tvTouchable = new TVTouchable(this, {
178-
getDisabled: () => this.props.disabled === true,
179-
onBlur: event => {
180-
if (this.props.onBlur != null) {
181-
this.props.onBlur(event);
182-
}
183-
},
184-
onFocus: event => {
185-
if (this.props.onFocus != null) {
186-
this.props.onFocus(event);
187-
}
188-
},
189-
onPress: event => {
190-
if (this.props.onPress != null) {
191-
this.props.onPress(event);
192-
}
193-
},
194-
});
195-
}
196-
}
197-
198172
componentDidUpdate(prevProps: Props, prevState: State) {
199173
this.state.pressability.configure(this._createPressabilityConfig());
200174
}
201175

202176
componentWillUnmount(): void {
203-
if (Platform.isTV) {
204-
if (this._tvTouchable != null) {
205-
this._tvTouchable.destroy();
206-
}
207-
}
208177
this.state.pressability.reset();
209178
}
210179
}

Libraries/Components/Touchable/TouchableHighlight.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Pressability, {
1616
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
1717
import StyleSheet, {type ViewStyleProp} from '../../StyleSheet/StyleSheet';
1818
import type {ColorValue} from '../../StyleSheet/StyleSheet';
19-
import TVTouchable from './TVTouchable';
2019
import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
2120
import Platform from '../../Utilities/Platform';
2221
import View from '../../Components/View/View';
@@ -158,7 +157,6 @@ type State = $ReadOnly<{|
158157
class TouchableHighlight extends React.Component<Props, State> {
159158
_hideTimeout: ?TimeoutID;
160159
_isMounted: boolean = false;
161-
_tvTouchable: ?TVTouchable;
162160

163161
state: State = {
164162
pressability: new Pressability(this._createPressabilityConfig()),
@@ -335,26 +333,6 @@ class TouchableHighlight extends React.Component<Props, State> {
335333

336334
componentDidMount(): void {
337335
this._isMounted = true;
338-
if (Platform.isTV) {
339-
this._tvTouchable = new TVTouchable(this, {
340-
getDisabled: () => this.props.disabled === true,
341-
onBlur: event => {
342-
if (this.props.onBlur != null) {
343-
this.props.onBlur(event);
344-
}
345-
},
346-
onFocus: event => {
347-
if (this.props.onFocus != null) {
348-
this.props.onFocus(event);
349-
}
350-
},
351-
onPress: event => {
352-
if (this.props.onPress != null) {
353-
this.props.onPress(event);
354-
}
355-
},
356-
});
357-
}
358336
}
359337

360338
componentDidUpdate(prevProps: Props, prevState: State) {
@@ -366,11 +344,6 @@ class TouchableHighlight extends React.Component<Props, State> {
366344
if (this._hideTimeout != null) {
367345
clearTimeout(this._hideTimeout);
368346
}
369-
if (Platform.isTV) {
370-
if (this._tvTouchable != null) {
371-
this._tvTouchable.destroy();
372-
}
373-
}
374347
this.state.pressability.reset();
375348
}
376349
}

Libraries/Components/Touchable/TouchableNativeFeedback.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import Pressability, {
1414
type PressabilityConfig,
1515
} from '../../Pressability/Pressability';
1616
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
17-
import TVTouchable from './TVTouchable';
1817
import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
1918
import {Commands} from 'react-native/Libraries/Components/View/ViewNativeComponent';
2019
import ReactNative from 'react-native/Libraries/Renderer/shims/ReactNative';
@@ -164,8 +163,6 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
164163
static canUseNativeForeground: () => boolean = () =>
165164
Platform.OS === 'android' && Platform.Version >= 23;
166165

167-
_tvTouchable: ?TVTouchable;
168-
169166
state: State = {
170167
pressability: new Pressability(this._createPressabilityConfig()),
171168
};
@@ -301,39 +298,11 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
301298
);
302299
}
303300

304-
componentDidMount(): void {
305-
if (Platform.isTV) {
306-
this._tvTouchable = new TVTouchable(this, {
307-
getDisabled: () => this.props.disabled === true,
308-
onBlur: event => {
309-
if (this.props.onBlur != null) {
310-
this.props.onBlur(event);
311-
}
312-
},
313-
onFocus: event => {
314-
if (this.props.onFocus != null) {
315-
this.props.onFocus(event);
316-
}
317-
},
318-
onPress: event => {
319-
if (this.props.onPress != null) {
320-
this.props.onPress(event);
321-
}
322-
},
323-
});
324-
}
325-
}
326-
327301
componentDidUpdate(prevProps: Props, prevState: State) {
328302
this.state.pressability.configure(this._createPressabilityConfig());
329303
}
330304

331305
componentWillUnmount(): void {
332-
if (Platform.isTV) {
333-
if (this._tvTouchable != null) {
334-
this._tvTouchable.destroy();
335-
}
336-
}
337306
this.state.pressability.reset();
338307
}
339308
}

0 commit comments

Comments
 (0)