react-native-tvos 0.76.1-0 → 0.76.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -1
  2. package/Libraries/Components/Pressable/Pressable.d.ts +9 -1
  3. package/Libraries/Components/Pressable/Pressable.js +4 -16
  4. package/Libraries/Components/TV/TVViewPropTypes.js +2 -1
  5. package/Libraries/Components/TextInput/TextInput.d.ts +1 -1
  6. package/Libraries/Components/Touchable/Touchable.js +0 -43
  7. package/Libraries/Components/Touchable/TouchableBounce.js +0 -33
  8. package/Libraries/Components/Touchable/TouchableHighlight.js +12 -47
  9. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +0 -33
  10. package/Libraries/Components/Touchable/TouchableOpacity.js +12 -44
  11. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -19
  12. package/Libraries/Components/View/ViewNativeComponent.js +6 -0
  13. package/Libraries/Components/View/ViewPropTypes.d.ts +12 -1
  14. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  15. package/Libraries/Core/ReactNativeVersion.js +1 -1
  16. package/Libraries/Core/setUpErrorHandling.js +1 -7
  17. package/Libraries/LogBox/Data/LogBoxData.js +2 -2
  18. package/Libraries/NativeComponent/BaseViewConfig.android.js +19 -0
  19. package/Libraries/NativeComponent/BaseViewConfig.ios.js +6 -0
  20. package/Libraries/NativeComponent/TVViewConfig.js +4 -0
  21. package/Libraries/Pressability/Pressability.js +45 -28
  22. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
  23. package/Libraries/Types/CoreEventTypes.d.ts +21 -0
  24. package/Libraries/Types/CoreEventTypes.js +6 -0
  25. package/README.md +9 -7
  26. package/React/Base/RCTTVRemoteHandler.m +0 -19
  27. package/React/Base/RCTTVRemoteSelectHandler.h +27 -0
  28. package/React/Base/RCTTVRemoteSelectHandler.m +120 -0
  29. package/React/Base/RCTVersion.m +1 -1
  30. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +12 -8
  31. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +47 -3
  32. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +8 -0
  33. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +51 -44
  34. package/React/Views/RCTTVView.h +19 -6
  35. package/React/Views/RCTTVView.m +63 -55
  36. package/React/Views/RCTViewManager.m +4 -0
  37. package/React/Views/ScrollView/RCTScrollView.m +12 -8
  38. package/ReactAndroid/api/ReactAndroid.api +0 -1
  39. package/ReactAndroid/cmake-utils/ReactNative-application.cmake +1 -1
  40. package/ReactAndroid/gradle.properties +1 -1
  41. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +2 -0
  42. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt +0 -8
  43. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  44. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +16 -0
  45. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +20 -0
  46. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BlurEvent.kt +16 -0
  47. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FocusEvent.kt +16 -0
  48. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PressInEvent.kt +16 -0
  49. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PressOutEvent.kt +16 -0
  50. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +11 -3
  51. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +212 -4
  52. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java +47 -4
  53. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  54. package/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputShadowNode.cpp +3 -2
  55. package/ReactCommon/react/renderer/components/view/BaseViewEventEmitter.cpp +18 -0
  56. package/ReactCommon/react/renderer/components/view/BaseViewEventEmitter.h +8 -0
  57. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +12 -1
  58. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +165 -2
  59. package/cli.js +1 -1
  60. package/index.js +0 -4
  61. package/package.json +8 -8
  62. package/scripts/codegen/generate-artifacts-executor.js +3 -3
  63. package/sdks/.hermesversion +1 -1
  64. package/sdks/hermesc/osx-bin/hermes +0 -0
  65. package/sdks/hermesc/osx-bin/hermesc +0 -0
  66. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  67. package/types/modules/Codegen.d.ts +6 -0
  68. package/types/public/ReactNativeTVTypes.d.ts +2 -2
  69. package/Libraries/Components/TabBarIOS/RCTTabBarItemNativeComponent.js +0 -99
  70. package/Libraries/Components/TabBarIOS/RCTTabBarNativeComponent.js +0 -32
  71. package/Libraries/Components/TabBarIOS/TabBarIOS.ios.js +0 -59
  72. package/Libraries/Components/TabBarIOS/TabBarIOS.js +0 -52
  73. package/Libraries/Components/TabBarIOS/TabBarIOSProps.js +0 -52
  74. package/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js +0 -177
  75. package/Libraries/Components/TabBarIOS/TabBarItemIOS.js +0 -55
  76. package/Libraries/Components/Touchable/TVTouchable.js +0 -71
  77. package/React/Views/RCTTabBar.h +0 -22
  78. package/React/Views/RCTTabBar.m +0 -237
  79. package/React/Views/RCTTabBarItem.h +0 -35
  80. package/React/Views/RCTTabBarItem.m +0 -139
  81. package/React/Views/RCTTabBarItemManager.h +0 -12
  82. package/React/Views/RCTTabBarItemManager.m +0 -38
  83. package/React/Views/RCTTabBarManager.h +0 -12
  84. package/React/Views/RCTTabBarManager.m +0 -81
@@ -1,177 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- * @noflow
9
- */
10
-
11
- 'use strict';
12
-
13
- import React from 'react';
14
- // const StaticContainer = require('../StaticContainer.react');
15
- const StyleSheet = require('../../StyleSheet/StyleSheet');
16
- const View = require('../View/View');
17
- const RCTTabBarItemNativeComponent = require('./RCTTabBarItemNativeComponent');
18
-
19
- import type {ViewProps} from '../View/ViewPropTypes';
20
- import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
21
- import type {SyntheticEvent} from '../../Types/CoreEventTypes';
22
- import type {ImageSource} from '../../Image/ImageSource';
23
-
24
- type Props = $ReadOnly<{|
25
- ...ViewProps,
26
-
27
- /**
28
- * Little red bubble that sits at the top right of the icon.
29
- */
30
- badge?: ?(string | number),
31
-
32
- /**
33
- * Background color for the badge. Available since iOS 10.
34
- */
35
- badgeColor?: ColorValue,
36
-
37
- /**
38
- * Items comes with a few predefined system icons. Note that if you are
39
- * using them, the title and selectedIcon will be overridden with the
40
- * system ones.
41
- */
42
- systemIcon?: ?(
43
- | 'bookmarks'
44
- | 'contacts'
45
- | 'downloads'
46
- | 'favorites'
47
- | 'featured'
48
- | 'history'
49
- | 'more'
50
- | 'most-recent'
51
- | 'most-viewed'
52
- | 'recents'
53
- | 'search'
54
- | 'top-rated'
55
- ),
56
-
57
- /**
58
- * A custom icon for the tab. It is ignored when a system icon is defined.
59
- */
60
- icon?: ?ImageSource,
61
-
62
- /**
63
- * A custom icon when the tab is selected. It is ignored when a system
64
- * icon is defined. If left empty, the icon will be tinted in blue.
65
- */
66
- selectedIcon?: ?ImageSource,
67
-
68
- /**
69
- * Callback when this tab is being selected, you should change the state of your
70
- * component to set selected={true}.
71
- */
72
- onPress?: ?(event: SyntheticEvent<null>) => mixed,
73
-
74
- /**
75
- * If set to true it renders the image as original,
76
- * it defaults to being displayed as a template
77
- */
78
- renderAsOriginal?: ?boolean,
79
-
80
- /**
81
- * It specifies whether the children are visible or not. If you see a
82
- * blank content, you probably forgot to add a selected one.
83
- */
84
- selected?: ?boolean,
85
-
86
- /**
87
- * Text that appears under the icon. It is ignored when a system icon
88
- * is defined.
89
- */
90
- title?: ?string,
91
-
92
- /**
93
- * *(Apple TV only)* When set to true, this view will be focusable
94
- * and navigable using the Apple TV remote.
95
- *
96
- * @platform ios
97
- */
98
- isTVSelectable?: ?boolean,
99
- |}>;
100
-
101
- type State = {|
102
- hasBeenSelected: boolean,
103
- |};
104
-
105
- let showedDeprecationWarning = true;
106
-
107
- class TabBarItemIOS extends React.Component<Props, State> {
108
- state = {
109
- hasBeenSelected: false,
110
- };
111
-
112
- UNSAFE_componentWillMount() {
113
- if (this.props.selected) {
114
- this.setState({hasBeenSelected: true});
115
- }
116
- }
117
-
118
- UNSAFE_componentWillReceiveProps(nextProps: Props) {
119
- if (this.state.hasBeenSelected || nextProps.selected) {
120
- this.setState({hasBeenSelected: true});
121
- }
122
- }
123
-
124
- componentDidMount() {
125
- if (!showedDeprecationWarning) {
126
- console.warn(
127
- 'TabBarIOS and TabBarItemIOS are deprecated and will be removed in a future release. ' +
128
- 'Please use react-native-tab-view instead.',
129
- );
130
-
131
- showedDeprecationWarning = true;
132
- }
133
- }
134
-
135
- render() {
136
- const {style, children, ...props} = this.props;
137
-
138
- /*
139
- // if the tab has already been shown once, always continue to show it so we
140
- // preserve state between tab transitions
141
- let tabContents;
142
- if (this.state.hasBeenSelected) {
143
- tabContents = (
144
- <StaticContainer shouldUpdate={this.props.selected}>
145
- {children}
146
- </StaticContainer>
147
- );
148
- } else {
149
- tabContents = <View />;
150
- }
151
-
152
- return (
153
- <RCTTabBarItemNativeComponent {...props} style={[styles.tab, style]}>
154
- {tabContents}
155
- </RCTTabBarItemNativeComponent>
156
- );
157
- */
158
- // TODO: properly replace StaticContainer
159
- return (
160
- <RCTTabBarItemNativeComponent {...props} style={[styles.tab, style]}>
161
- {children}
162
- </RCTTabBarItemNativeComponent>
163
- );
164
- }
165
- }
166
-
167
- const styles = StyleSheet.create({
168
- tab: {
169
- position: 'absolute',
170
- top: 0,
171
- right: 0,
172
- bottom: 0,
173
- left: 0,
174
- },
175
- });
176
-
177
- module.exports = TabBarItemIOS;
@@ -1,55 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- * @noflow
9
- */
10
-
11
- 'use strict';
12
-
13
- import React from 'react';
14
-
15
- const StyleSheet = require('../../StyleSheet/StyleSheet');
16
- const View = require('../View/View');
17
-
18
- let showedDeprecationWarning = false;
19
-
20
- class DummyTab extends React.Component {
21
- componentDidMount() {
22
- if (!showedDeprecationWarning) {
23
- console.warn(
24
- 'TabBarIOS and TabBarItemIOS are deprecated and will be removed in a future release. ' +
25
- 'Please use react-native-tab-view instead.',
26
- );
27
-
28
- showedDeprecationWarning = true;
29
- }
30
- }
31
-
32
- render() {
33
- if (!this.props.selected) {
34
- return <View />;
35
- }
36
- return (
37
- <View style={[this.props.style, styles.tab]}>{this.props.children}</View>
38
- );
39
- }
40
- }
41
-
42
- const styles = StyleSheet.create({
43
- tab: {
44
- // TODO(5405356): Implement overflow: visible so position: absolute isn't useless
45
- // position: 'absolute',
46
- top: 0,
47
- right: 0,
48
- bottom: 0,
49
- left: 0,
50
- borderColor: 'red',
51
- borderWidth: 1,
52
- },
53
- });
54
-
55
- module.exports = DummyTab;
@@ -1,71 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- import type {
14
- BlurEvent,
15
- FocusEvent,
16
- PressEvent,
17
- } from '../../Types/CoreEventTypes';
18
-
19
- import Platform from '../../Utilities/Platform';
20
- import tagForComponentOrHandle from '../TV/tagForComponentOrHandle';
21
- import {tvFocusEventHandler} from '../TV/TVFocusEventHandler';
22
- import invariant from 'invariant';
23
-
24
- type TVTouchableConfig = $ReadOnly<{|
25
- getDisabled: () => boolean,
26
- onBlur: (event: BlurEvent) => mixed,
27
- onFocus: (event: FocusEvent) => mixed,
28
- onPress: (event: PressEvent) => mixed,
29
- onLongPress: (event: PressEvent) => mixed,
30
- |}>;
31
-
32
- export default class TVTouchable {
33
- _enabled: boolean = false;
34
- _focusEventHandler: ?any = null;
35
- _viewTag: ?number = null;
36
-
37
- constructor(component: any, config: TVTouchableConfig) {
38
- invariant(Platform.isTV, 'TVTouchable: Requires `Platform.isTV`.');
39
- if (!Platform.isTV) {
40
- return;
41
- }
42
- const _tvtouchable = this; // eslint-disable-line consistent-this
43
- this._viewTag = tagForComponentOrHandle(component);
44
- tvFocusEventHandler?.register(this._viewTag, tvData => {
45
- if (!_tvtouchable._enabled) {
46
- return;
47
- }
48
- if (tagForComponentOrHandle(component) === tvData.tag) {
49
- if (tvData.eventType === 'focus') {
50
- config.onFocus(tvData);
51
- } else if (tvData.eventType === 'blur') {
52
- config.onBlur(tvData);
53
- } else if (tvData.eventType === 'select') {
54
- if (!config.getDisabled()) {
55
- config.onPress(tvData);
56
- }
57
- } else if (tvData.eventType === 'longSelect') {
58
- if (!config.getDisabled()) {
59
- config.onLongPress(tvData);
60
- }
61
- }
62
- }
63
- });
64
- this._enabled = true;
65
- }
66
-
67
- destroy(): void {
68
- this._enabled = false;
69
- tvFocusEventHandler?.unregister(this._viewTag);
70
- }
71
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import <UIKit/UIKit.h>
9
-
10
- @interface RCTTabBar : UIView
11
-
12
- @property (nonatomic, strong) UIColor *unselectedTintColor;
13
- @property (nonatomic, strong) UIColor *tintColor;
14
- @property (nonatomic, strong) UIColor *barTintColor;
15
- @property (nonatomic, assign) BOOL translucent;
16
- #if !TARGET_OS_TV
17
- @property (nonatomic, assign) UIBarStyle barStyle;
18
- #endif
19
-
20
- - (void)uiManagerDidPerformMounting;
21
-
22
- @end
@@ -1,237 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import "RCTTabBar.h"
9
-
10
- #import "RCTEventDispatcher.h"
11
- #import "RCTLog.h"
12
- #import "RCTTabBarItem.h"
13
- #import "RCTUtils.h"
14
- #import "RCTView.h"
15
- #import "RCTWrapperViewController.h"
16
- #import "UIView+React.h"
17
-
18
- @interface RCTTabBar() <UITabBarControllerDelegate>
19
-
20
- @end
21
-
22
- @implementation RCTTabBar
23
- {
24
- BOOL _tabsChanged;
25
- UITabBarController *_tabController;
26
- }
27
-
28
- - (instancetype)initWithFrame:(CGRect)frame
29
- {
30
- if ((self = [super initWithFrame:frame])) {
31
- _tabController = [UITabBarController new];
32
- _tabController.delegate = self;
33
- [self addSubview:_tabController.view];
34
- }
35
- return self;
36
- }
37
-
38
- RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
39
-
40
- - (UIViewController *)reactViewController
41
- {
42
- return _tabController;
43
- }
44
-
45
- - (void)dealloc
46
- {
47
- _tabController.delegate = nil;
48
- [_tabController removeFromParentViewController];
49
- }
50
-
51
- - (void)insertReactSubview:(RCTTabBarItem *)subview atIndex:(NSInteger)atIndex
52
- {
53
- if (![subview isKindOfClass:[RCTTabBarItem class]]) {
54
- RCTLogError(@"subview should be of type RCTTabBarItem");
55
- return;
56
- }
57
- [super insertReactSubview:subview atIndex:atIndex];
58
- _tabsChanged = YES;
59
- }
60
-
61
- - (void)removeReactSubview:(RCTTabBarItem *)subview
62
- {
63
- if (self.reactSubviews.count == 0) {
64
- RCTLogError(@"should have at least one view to remove a subview");
65
- return;
66
- }
67
- [super removeReactSubview:subview];
68
- _tabsChanged = YES;
69
- }
70
-
71
- - (void)didUpdateReactSubviews
72
- {
73
- // Do nothing, as subviews are managed by `uiManagerDidPerformMounting`
74
- }
75
-
76
- - (void)layoutSubviews
77
- {
78
- [super layoutSubviews];
79
- [self reactAddControllerToClosestParent:_tabController];
80
- _tabController.view.frame = self.bounds;
81
- }
82
-
83
- - (void)uiManagerDidPerformMounting
84
- {
85
- // we can't hook up the VC hierarchy in 'init' because the subviews aren't
86
- // hooked up yet, so we do it on demand here whenever a transaction has finished
87
- [self reactAddControllerToClosestParent:_tabController];
88
-
89
- if (_tabsChanged) {
90
-
91
- NSMutableArray<UIViewController *> *viewControllers = [NSMutableArray array];
92
- for (RCTTabBarItem *tab in [self reactSubviews]) {
93
- UIViewController *controller = tab.reactViewController;
94
- if (!controller) {
95
- controller = [[RCTWrapperViewController alloc] initWithContentView:tab];
96
- }
97
- [viewControllers addObject:controller];
98
- }
99
-
100
- _tabController.viewControllers = viewControllers;
101
- _tabsChanged = NO;
102
- }
103
-
104
- [self.reactSubviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger index, __unused BOOL *stop) {
105
-
106
- RCTTabBarItem *tab = (RCTTabBarItem *)view;
107
- UIViewController *controller = self->_tabController.viewControllers[index];
108
- if (self->_unselectedTintColor) {
109
- [tab.barItem setTitleTextAttributes:@{NSForegroundColorAttributeName: self->_unselectedTintColor} forState:UIControlStateNormal];
110
- }
111
-
112
- [tab.barItem setTitleTextAttributes:@{NSForegroundColorAttributeName: self.tintColor} forState:UIControlStateSelected];
113
-
114
- controller.tabBarItem = tab.barItem;
115
- #if TARGET_OS_TV
116
- // On Apple TV, disable JS control of selection after initial render
117
- if (tab.selected && !tab.wasSelectedInJS) {
118
- self->_tabController.selectedViewController = controller;
119
- }
120
- tab.wasSelectedInJS = YES;
121
- #else
122
- if (tab.selected) {
123
- self->_tabController.selectedViewController = controller;
124
- }
125
- #endif
126
- }];
127
- }
128
-
129
- - (UIColor *)barTintColor
130
- {
131
- return _tabController.tabBar.barTintColor;
132
- }
133
-
134
- - (void)setBarTintColor:(UIColor *)barTintColor
135
- {
136
- _tabController.tabBar.barTintColor = barTintColor;
137
- }
138
-
139
- - (UIColor *)tintColor
140
- {
141
- return _tabController.tabBar.tintColor;
142
- }
143
-
144
- - (void)setTintColor:(UIColor *)tintColor
145
- {
146
- _tabController.tabBar.tintColor = tintColor;
147
- }
148
-
149
- - (BOOL)translucent
150
- {
151
- return _tabController.tabBar.isTranslucent;
152
- }
153
-
154
- - (void)setTranslucent:(BOOL)translucent
155
- {
156
- _tabController.tabBar.translucent = translucent;
157
- }
158
-
159
- #if !TARGET_OS_TV
160
- - (UIBarStyle)barStyle
161
- {
162
- return _tabController.tabBar.barStyle;
163
- }
164
-
165
- - (void)setBarStyle:(UIBarStyle)barStyle
166
- {
167
- _tabController.tabBar.barStyle = barStyle;
168
- }
169
- #endif
170
-
171
- - (void)setUnselectedItemTintColor:(UIColor *)unselectedItemTintColor {
172
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
173
- if ([_tabController.tabBar respondsToSelector:@selector(unselectedItemTintColor)]) {
174
- _tabController.tabBar.unselectedItemTintColor = unselectedItemTintColor;
175
- }
176
- #endif
177
- }
178
-
179
- - (UITabBarItemPositioning)itemPositioning
180
- {
181
- #if TARGET_OS_TV
182
- return 0;
183
- #else
184
- return _tabController.tabBar.itemPositioning;
185
- #endif
186
- }
187
-
188
- - (void)setItemPositioning:(UITabBarItemPositioning)itemPositioning
189
- {
190
- #if !TARGET_OS_TV
191
- _tabController.tabBar.itemPositioning = itemPositioning;
192
- #endif
193
- }
194
-
195
- #pragma mark - UITabBarControllerDelegate
196
-
197
- #if TARGET_OS_TV
198
-
199
- - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(nonnull UIViewController *)viewController
200
- {
201
- NSUInteger index = [tabBarController.viewControllers indexOfObject:viewController];
202
- RCTTabBarItem *tab = (RCTTabBarItem *)self.reactSubviews[index];
203
- if (tab.onPress) tab.onPress(nil);
204
- return;
205
- }
206
-
207
- #else
208
-
209
- - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
210
- {
211
- NSUInteger index = [tabBarController.viewControllers indexOfObject:viewController];
212
- RCTTabBarItem *tab = (RCTTabBarItem *)self.reactSubviews[index];
213
- if (tab.onPress) tab.onPress(nil);
214
- return NO;
215
- }
216
-
217
- #endif
218
-
219
- #if TARGET_OS_TV
220
-
221
- - (BOOL)isUserInteractionEnabled
222
- {
223
- return YES;
224
- }
225
-
226
- - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
227
- {
228
- if (context.nextFocusedView == self) {
229
- [self becomeFirstResponder];
230
- } else {
231
- [self resignFirstResponder];
232
- }
233
- }
234
-
235
- #endif
236
-
237
- @end
@@ -1,35 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import <UIKit/UIKit.h>
9
-
10
- #import <React/RCTComponent.h>
11
- #import <React/RCTConvert.h>
12
-
13
- @interface RCTConvert (UITabBarSystemItem)
14
-
15
- + (UITabBarSystemItem)UITabBarSystemItem:(id)json;
16
-
17
- @end
18
-
19
- @interface RCTTabBarItem : UIView
20
-
21
- @property (nonatomic, copy) id /* NSString or NSNumber */ badge;
22
- @property (nonatomic, strong) UIImage *icon;
23
- @property (nonatomic, strong) UIImage *selectedIcon;
24
- @property (nonatomic, assign) UITabBarSystemItem systemIcon;
25
- @property (nonatomic, assign) BOOL renderAsOriginal;
26
- @property (nonatomic, assign, getter=isSelected) BOOL selected;
27
- @property (nonatomic, readonly) UITabBarItem *barItem;
28
- @property (nonatomic, copy) RCTBubblingEventBlock onPress;
29
- @property (nonatomic, strong) NSString *testID;
30
-
31
- #if TARGET_OS_TV
32
- @property (nonatomic, assign) BOOL wasSelectedInJS;
33
- #endif
34
-
35
- @end