react-native-tvos 0.76.1-1 → 0.76.3-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.
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -1
- package/Libraries/Components/Pressable/Pressable.d.ts +8 -0
- package/Libraries/Components/Pressable/Pressable.js +4 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpErrorHandling.js +1 -7
- package/Libraries/LogBox/Data/LogBoxData.js +2 -2
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
- package/Libraries/Types/CoreEventTypes.d.ts +3 -3
- package/README.md +9 -7
- package/React/Base/RCTTVRemoteHandler.m +0 -19
- package/React/Base/RCTTVRemoteSelectHandler.h +27 -0
- package/React/Base/RCTTVRemoteSelectHandler.m +120 -0
- package/React/Base/RCTVersion.m +2 -2
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +12 -8
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +47 -3
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +8 -0
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +35 -42
- package/React/Views/RCTTVView.h +9 -14
- package/React/Views/RCTTVView.m +34 -46
- package/React/Views/RCTView.h +19 -0
- package/React/Views/ScrollView/RCTScrollView.m +12 -8
- package/ReactAndroid/api/ReactAndroid.api +0 -1
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +3 -4
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle.kts +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt +0 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +11 -3
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputShadowNode.cpp +3 -2
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +12 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +165 -2
- package/cli.js +1 -1
- package/index.js +0 -4
- package/package.json +8 -8
- package/scripts/codegen/generate-artifacts-executor.js +3 -3
- package/sdks/.hermesversion +1 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
- package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
- package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
- package/types/modules/Codegen.d.ts +6 -0
- package/types/public/ReactNativeTVTypes.d.ts +1 -1
- package/Libraries/Components/TabBarIOS/RCTTabBarItemNativeComponent.js +0 -99
- package/Libraries/Components/TabBarIOS/RCTTabBarNativeComponent.js +0 -32
- package/Libraries/Components/TabBarIOS/TabBarIOS.ios.js +0 -59
- package/Libraries/Components/TabBarIOS/TabBarIOS.js +0 -52
- package/Libraries/Components/TabBarIOS/TabBarIOSProps.js +0 -52
- package/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js +0 -177
- package/Libraries/Components/TabBarIOS/TabBarItemIOS.js +0 -55
- package/React/Views/RCTTabBar.h +0 -22
- package/React/Views/RCTTabBar.m +0 -237
- package/React/Views/RCTTabBarItem.h +0 -35
- package/React/Views/RCTTabBarItem.m +0 -139
- package/React/Views/RCTTabBarItemManager.h +0 -12
- package/React/Views/RCTTabBarItemManager.m +0 -38
- package/React/Views/RCTTabBarManager.h +0 -12
- package/React/Views/RCTTabBarManager.m +0 -81
package/React/Views/RCTTabBar.m
DELETED
|
@@ -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
|
|
@@ -1,139 +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 "RCTTabBarItem.h"
|
|
9
|
-
|
|
10
|
-
#import "RCTConvert.h"
|
|
11
|
-
#import "RCTLog.h"
|
|
12
|
-
#import "UIView+React.h"
|
|
13
|
-
|
|
14
|
-
@implementation RCTConvert (UITabBarSystemItem)
|
|
15
|
-
|
|
16
|
-
RCT_ENUM_CONVERTER(UITabBarSystemItem, (@{
|
|
17
|
-
@"bookmarks": @(UITabBarSystemItemBookmarks),
|
|
18
|
-
@"contacts": @(UITabBarSystemItemContacts),
|
|
19
|
-
@"downloads": @(UITabBarSystemItemDownloads),
|
|
20
|
-
@"favorites": @(UITabBarSystemItemFavorites),
|
|
21
|
-
@"featured": @(UITabBarSystemItemFeatured),
|
|
22
|
-
@"history": @(UITabBarSystemItemHistory),
|
|
23
|
-
@"more": @(UITabBarSystemItemMore),
|
|
24
|
-
@"most-recent": @(UITabBarSystemItemMostRecent),
|
|
25
|
-
@"most-viewed": @(UITabBarSystemItemMostViewed),
|
|
26
|
-
@"recents": @(UITabBarSystemItemRecents),
|
|
27
|
-
@"search": @(UITabBarSystemItemSearch),
|
|
28
|
-
@"top-rated": @(UITabBarSystemItemTopRated),
|
|
29
|
-
}), NSNotFound, integerValue)
|
|
30
|
-
|
|
31
|
-
@end
|
|
32
|
-
|
|
33
|
-
@implementation RCTTabBarItem{
|
|
34
|
-
UITapGestureRecognizer *_selectRecognizer;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@synthesize barItem = _barItem;
|
|
38
|
-
|
|
39
|
-
- (instancetype)initWithFrame:(CGRect)frame
|
|
40
|
-
{
|
|
41
|
-
if ((self = [super initWithFrame:frame])) {
|
|
42
|
-
_systemIcon = NSNotFound;
|
|
43
|
-
#if TARGET_OS_TV
|
|
44
|
-
_wasSelectedInJS = NO;
|
|
45
|
-
#endif
|
|
46
|
-
}
|
|
47
|
-
return self;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
- (UITabBarItem *)barItem
|
|
51
|
-
{
|
|
52
|
-
if (!_barItem) {
|
|
53
|
-
_barItem = [UITabBarItem new];
|
|
54
|
-
_systemIcon = NSNotFound;
|
|
55
|
-
}
|
|
56
|
-
return _barItem;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
- (void)setTestID:(NSString *)testID
|
|
60
|
-
{
|
|
61
|
-
self.barItem.accessibilityIdentifier = testID;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
- (void)setBadge:(id)badge
|
|
65
|
-
{
|
|
66
|
-
_badge = [badge copy];
|
|
67
|
-
self.barItem.badgeValue = [badge description];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
- (void)setSystemIcon:(UITabBarSystemItem)systemIcon
|
|
71
|
-
{
|
|
72
|
-
if (_systemIcon != systemIcon) {
|
|
73
|
-
_systemIcon = systemIcon;
|
|
74
|
-
UITabBarItem *oldItem = _barItem;
|
|
75
|
-
_barItem = [[UITabBarItem alloc] initWithTabBarSystemItem:_systemIcon
|
|
76
|
-
tag:oldItem.tag];
|
|
77
|
-
_barItem.title = oldItem.title;
|
|
78
|
-
_barItem.imageInsets = oldItem.imageInsets;
|
|
79
|
-
_barItem.badgeValue = oldItem.badgeValue;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
- (void)setIcon:(UIImage *)icon
|
|
84
|
-
{
|
|
85
|
-
_icon = icon;
|
|
86
|
-
if (_icon && _systemIcon != NSNotFound) {
|
|
87
|
-
_systemIcon = NSNotFound;
|
|
88
|
-
UITabBarItem *oldItem = _barItem;
|
|
89
|
-
_barItem = [UITabBarItem new];
|
|
90
|
-
_barItem.title = oldItem.title;
|
|
91
|
-
_barItem.imageInsets = oldItem.imageInsets;
|
|
92
|
-
_barItem.selectedImage = oldItem.selectedImage;
|
|
93
|
-
_barItem.badgeValue = oldItem.badgeValue;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (_renderAsOriginal) {
|
|
97
|
-
self.barItem.image = [_icon imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
98
|
-
} else {
|
|
99
|
-
self.barItem.image = _icon;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
- (void)setSelectedIcon:(UIImage *)selectedIcon
|
|
104
|
-
{
|
|
105
|
-
_selectedIcon = selectedIcon;
|
|
106
|
-
|
|
107
|
-
if (_renderAsOriginal) {
|
|
108
|
-
self.barItem.selectedImage = [_selectedIcon imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
109
|
-
} else {
|
|
110
|
-
self.barItem.selectedImage = _selectedIcon;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
- (void)setBadgeColor:(UIColor *)badgeColor
|
|
115
|
-
{
|
|
116
|
-
// badgeColor available since iOS 10
|
|
117
|
-
if ([self.barItem respondsToSelector:@selector(badgeColor)]) {
|
|
118
|
-
self.barItem.badgeColor = badgeColor;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
- (UIViewController *)reactViewController
|
|
123
|
-
{
|
|
124
|
-
return self.superview.reactViewController;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#if TARGET_OS_TV
|
|
128
|
-
|
|
129
|
-
// On Apple TV, we let native control the tab bar selection after initial render
|
|
130
|
-
- (void)setSelected:(BOOL)selected
|
|
131
|
-
{
|
|
132
|
-
if (!_wasSelectedInJS) {
|
|
133
|
-
_selected = selected;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
#endif
|
|
138
|
-
|
|
139
|
-
@end
|
|
@@ -1,12 +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 <React/RCTViewManager.h>
|
|
9
|
-
|
|
10
|
-
@interface RCTTabBarItemManager : RCTViewManager
|
|
11
|
-
|
|
12
|
-
@end
|
|
@@ -1,38 +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 "RCTTabBarItemManager.h"
|
|
9
|
-
|
|
10
|
-
#import "RCTConvert.h"
|
|
11
|
-
#import "RCTTabBarItem.h"
|
|
12
|
-
|
|
13
|
-
@implementation RCTTabBarItemManager
|
|
14
|
-
|
|
15
|
-
RCT_EXPORT_MODULE()
|
|
16
|
-
|
|
17
|
-
- (UIView *)view
|
|
18
|
-
{
|
|
19
|
-
return [RCTTabBarItem new];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
RCT_EXPORT_VIEW_PROPERTY(badge, id /* NSString or NSNumber */)
|
|
23
|
-
RCT_EXPORT_VIEW_PROPERTY(renderAsOriginal, BOOL)
|
|
24
|
-
RCT_EXPORT_VIEW_PROPERTY(selected, BOOL)
|
|
25
|
-
RCT_EXPORT_VIEW_PROPERTY(icon, UIImage)
|
|
26
|
-
RCT_EXPORT_VIEW_PROPERTY(selectedIcon, UIImage)
|
|
27
|
-
RCT_EXPORT_VIEW_PROPERTY(systemIcon, UITabBarSystemItem)
|
|
28
|
-
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
29
|
-
RCT_EXPORT_VIEW_PROPERTY(badgeColor, UIColor)
|
|
30
|
-
RCT_EXPORT_VIEW_PROPERTY(isTVSelectable, BOOL)
|
|
31
|
-
RCT_EXPORT_VIEW_PROPERTY(testID, NSString)
|
|
32
|
-
RCT_CUSTOM_VIEW_PROPERTY(title, NSString, RCTTabBarItem)
|
|
33
|
-
{
|
|
34
|
-
view.barItem.title = json ? [RCTConvert NSString:json] : defaultView.barItem.title;
|
|
35
|
-
view.barItem.imageInsets = view.barItem.title.length ? UIEdgeInsetsZero : (UIEdgeInsets){6, 0, -6, 0};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@end
|
|
@@ -1,12 +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 <React/RCTViewManager.h>
|
|
9
|
-
|
|
10
|
-
@interface RCTTabBarManager : RCTViewManager
|
|
11
|
-
|
|
12
|
-
@end
|
|
@@ -1,81 +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 "RCTTabBarManager.h"
|
|
9
|
-
|
|
10
|
-
#import "RCTBridge.h"
|
|
11
|
-
#import "RCTTabBar.h"
|
|
12
|
-
#import "RCTUIManager.h"
|
|
13
|
-
#import "RCTUIManagerObserverCoordinator.h"
|
|
14
|
-
|
|
15
|
-
@implementation RCTConvert (UITabBar)
|
|
16
|
-
|
|
17
|
-
RCT_ENUM_CONVERTER(UITabBarItemPositioning, (@{
|
|
18
|
-
@"fill" : @(UITabBarItemPositioningFill),
|
|
19
|
-
@"auto" : @(UITabBarItemPositioningAutomatic),
|
|
20
|
-
@"center" : @(UITabBarItemPositioningCentered)
|
|
21
|
-
}), UITabBarItemPositioningAutomatic, integerValue)
|
|
22
|
-
|
|
23
|
-
@end
|
|
24
|
-
|
|
25
|
-
@interface RCTTabBarManager () <RCTUIManagerObserver>
|
|
26
|
-
|
|
27
|
-
@end
|
|
28
|
-
|
|
29
|
-
@implementation RCTTabBarManager
|
|
30
|
-
{
|
|
31
|
-
// The main thread only.
|
|
32
|
-
NSHashTable<RCTTabBar *> *_viewRegistry;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
- (void)setBridge:(RCTBridge *)bridge
|
|
36
|
-
{
|
|
37
|
-
[super setBridge:bridge];
|
|
38
|
-
|
|
39
|
-
[self.bridge.uiManager.observerCoordinator addObserver:self];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
- (void)invalidate
|
|
43
|
-
{
|
|
44
|
-
[self.bridge.uiManager.observerCoordinator removeObserver:self];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
RCT_EXPORT_MODULE()
|
|
48
|
-
|
|
49
|
-
- (UIView *)view
|
|
50
|
-
{
|
|
51
|
-
if (!_viewRegistry) {
|
|
52
|
-
_viewRegistry = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
RCTTabBar *view = [RCTTabBar new];
|
|
56
|
-
[_viewRegistry addObject:view];
|
|
57
|
-
return view;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
RCT_EXPORT_VIEW_PROPERTY(unselectedTintColor, UIColor)
|
|
61
|
-
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
|
|
62
|
-
RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor)
|
|
63
|
-
RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL)
|
|
64
|
-
#if !TARGET_OS_TV
|
|
65
|
-
RCT_EXPORT_VIEW_PROPERTY(barStyle, UIBarStyle)
|
|
66
|
-
#endif
|
|
67
|
-
RCT_EXPORT_VIEW_PROPERTY(itemPositioning, UITabBarItemPositioning)
|
|
68
|
-
RCT_EXPORT_VIEW_PROPERTY(unselectedItemTintColor, UIColor)
|
|
69
|
-
|
|
70
|
-
#pragma mark - RCTUIManagerObserver
|
|
71
|
-
|
|
72
|
-
- (void)uiManagerDidPerformMounting:(__unused RCTUIManager *)manager
|
|
73
|
-
{
|
|
74
|
-
RCTExecuteOnMainQueue(^{
|
|
75
|
-
for (RCTTabBar *view in self->_viewRegistry) {
|
|
76
|
-
[view uiManagerDidPerformMounting];
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@end
|