@onekeyfe/react-native-tab-view 1.1.31
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/android/build.gradle +119 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/rcttabview/ImageSource.kt +86 -0
- package/android/src/main/java/com/rcttabview/RCTTabView.kt +529 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewManager.kt +204 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewPackage.kt +16 -0
- package/android/src/main/java/com/rcttabview/TabInfo.kt +12 -0
- package/android/src/main/java/com/rcttabview/Utils.kt +31 -0
- package/android/src/main/java/com/rcttabview/events/OnNativeLayoutEvent.kt +20 -0
- package/android/src/main/java/com/rcttabview/events/OnTabBarMeasuredEvent.kt +19 -0
- package/android/src/main/java/com/rcttabview/events/PageSelectedEvent.kt +21 -0
- package/android/src/main/java/com/rcttabview/events/TabLongPressedEvent.kt +19 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewComponentDescriptor.h +32 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.cpp +18 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.h +35 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.cpp +15 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.h +25 -0
- package/ios/Extensions.swift +46 -0
- package/ios/RCTBottomAccessoryComponentView.h +12 -0
- package/ios/RCTBottomAccessoryComponentView.mm +67 -0
- package/ios/RCTBottomAccessoryContainerView.swift +51 -0
- package/ios/RCTTabViewComponentView.h +12 -0
- package/ios/RCTTabViewComponentView.mm +325 -0
- package/ios/RCTTabViewContainerView.swift +768 -0
- package/ios/RCTTabViewLog.h +7 -0
- package/ios/RCTTabViewLog.m +32 -0
- package/ios/SVG/CoreSVG.h +13 -0
- package/ios/SVG/CoreSVG.mm +177 -0
- package/ios/SVG/SvgDecoder.h +10 -0
- package/ios/SVG/SvgDecoder.mm +32 -0
- package/ios/TabBarFontSize.swift +55 -0
- package/lib/module/BottomAccessoryView.js +45 -0
- package/lib/module/BottomAccessoryView.js.map +1 -0
- package/lib/module/BottomAccessoryViewNativeComponent.ts +27 -0
- package/lib/module/DelayedFreeze.js +26 -0
- package/lib/module/DelayedFreeze.js.map +1 -0
- package/lib/module/NativeSVGDecoder.js +5 -0
- package/lib/module/NativeSVGDecoder.js.map +1 -0
- package/lib/module/SceneMap.js +28 -0
- package/lib/module/SceneMap.js.map +1 -0
- package/lib/module/TabView.js +263 -0
- package/lib/module/TabView.js.map +1 -0
- package/lib/module/TabViewNativeComponent.ts +68 -0
- package/lib/module/codegen-types.d.js +2 -0
- package/lib/module/codegen-types.d.js.map +1 -0
- package/lib/module/index.js +20 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/BottomTabBarHeightContext.js +5 -0
- package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -0
- package/lib/module/utils/useBottomTabBarHeight.js +12 -0
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts +8 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts.map +1 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +16 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/DelayedFreeze.d.ts +8 -0
- package/lib/typescript/src/DelayedFreeze.d.ts.map +1 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts +6 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts.map +1 -0
- package/lib/typescript/src/SceneMap.d.ts +10 -0
- package/lib/typescript/src/SceneMap.d.ts.map +1 -0
- package/lib/typescript/src/TabView.d.ts +178 -0
- package/lib/typescript/src/TabView.d.ts.map +1 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts +55 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +16 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +29 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +3 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +2 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -0
- package/package.json +114 -0
- package/react-native-tab-view.podspec +36 -0
- package/react-native.config.js +13 -0
- package/src/BottomAccessoryView.tsx +58 -0
- package/src/BottomAccessoryViewNativeComponent.ts +27 -0
- package/src/DelayedFreeze.tsx +27 -0
- package/src/NativeSVGDecoder.ts +5 -0
- package/src/SceneMap.tsx +34 -0
- package/src/TabView.tsx +466 -0
- package/src/TabViewNativeComponent.ts +68 -0
- package/src/codegen-types.d.ts +28 -0
- package/src/index.tsx +18 -0
- package/src/types.ts +31 -0
- package/src/utils/BottomTabBarHeightContext.ts +5 -0
- package/src/utils/useBottomTabBarHeight.ts +15 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
#import "RCTTabViewComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNCTabView/RNCTabViewComponentDescriptor.h>
|
|
4
|
+
#import <react/renderer/components/RNCTabView/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/RNCTabView/Props.h>
|
|
6
|
+
#import <react/renderer/components/RNCTabView/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
9
|
+
#import <React/RCTConversions.h>
|
|
10
|
+
#import <React/RCTImageLoader.h>
|
|
11
|
+
#import <React/RCTImageSource.h>
|
|
12
|
+
#import <React/RCTBridge+Private.h>
|
|
13
|
+
#import <react/utils/ManagedObjectWrapper.h>
|
|
14
|
+
|
|
15
|
+
#if __has_include(<TabViewModule/TabViewModule-Swift.h>)
|
|
16
|
+
#import <TabViewModule/TabViewModule-Swift.h>
|
|
17
|
+
#elif __has_include("TabViewModule/TabViewModule-Swift.h")
|
|
18
|
+
#import "TabViewModule/TabViewModule-Swift.h"
|
|
19
|
+
#elif __has_include("TabViewModule-Swift.h")
|
|
20
|
+
#import "TabViewModule-Swift.h"
|
|
21
|
+
#else
|
|
22
|
+
#import "react_native_tab_view-Swift.h"
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
using namespace facebook::react;
|
|
26
|
+
|
|
27
|
+
static inline NSString* _Nullable NSStringFromStdStringNilIfEmpty(const std::string &string) {
|
|
28
|
+
return string.empty() ? nil : [NSString stringWithUTF8String:string.c_str()];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Overload `==` and `!=` operators for `RNCTabViewItemsStruct`
|
|
32
|
+
namespace facebook::react {
|
|
33
|
+
|
|
34
|
+
bool operator==(const RNCTabViewItemsStruct& lhs, const RNCTabViewItemsStruct& rhs) {
|
|
35
|
+
return lhs.key == rhs.key &&
|
|
36
|
+
lhs.title == rhs.title &&
|
|
37
|
+
lhs.sfSymbol == rhs.sfSymbol &&
|
|
38
|
+
lhs.badge == rhs.badge &&
|
|
39
|
+
lhs.activeTintColor == rhs.activeTintColor &&
|
|
40
|
+
lhs.hidden == rhs.hidden &&
|
|
41
|
+
lhs.testID == rhs.testID &&
|
|
42
|
+
lhs.role == rhs.role &&
|
|
43
|
+
lhs.preventsDefault == rhs.preventsDefault;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
bool operator!=(const RNCTabViewItemsStruct& lhs, const RNCTabViewItemsStruct& rhs) {
|
|
47
|
+
return !(lhs == rhs);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static NSNumber* _Nullable colorToProcessedInt(const SharedColor &color) {
|
|
53
|
+
UIColor *uiColor = RCTUIColorFromSharedColor(color);
|
|
54
|
+
if (!uiColor) return nil;
|
|
55
|
+
CGFloat r, g, b, a;
|
|
56
|
+
[uiColor getRed:&r green:&g blue:&b alpha:&a];
|
|
57
|
+
int32_t colorInt = ((int)(a * 255) << 24) | ((int)(r * 255) << 16) | ((int)(g * 255) << 8) | (int)(b * 255);
|
|
58
|
+
return @(colorInt);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static NSArray<NSDictionary *>* convertItemsToArray(const std::vector<RNCTabViewItemsStruct>& items) {
|
|
62
|
+
NSMutableArray *result = [NSMutableArray arrayWithCapacity:items.size()];
|
|
63
|
+
|
|
64
|
+
for (const auto& item : items) {
|
|
65
|
+
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
66
|
+
dict[@"key"] = [NSString stringWithUTF8String:item.key.c_str()];
|
|
67
|
+
dict[@"title"] = [NSString stringWithUTF8String:item.title.c_str()];
|
|
68
|
+
|
|
69
|
+
if (!item.sfSymbol.empty()) {
|
|
70
|
+
dict[@"sfSymbol"] = [NSString stringWithUTF8String:item.sfSymbol.c_str()];
|
|
71
|
+
}
|
|
72
|
+
if (!item.badge.empty()) {
|
|
73
|
+
dict[@"badge"] = [NSString stringWithUTF8String:item.badge.c_str()];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
NSNumber *activeTint = colorToProcessedInt(item.activeTintColor);
|
|
77
|
+
if (activeTint) dict[@"activeTintColor"] = activeTint;
|
|
78
|
+
|
|
79
|
+
NSNumber *badgeBg = colorToProcessedInt(item.badgeBackgroundColor);
|
|
80
|
+
if (badgeBg) dict[@"badgeBackgroundColor"] = badgeBg;
|
|
81
|
+
|
|
82
|
+
NSNumber *badgeTxt = colorToProcessedInt(item.badgeTextColor);
|
|
83
|
+
if (badgeTxt) dict[@"badgeTextColor"] = badgeTxt;
|
|
84
|
+
|
|
85
|
+
dict[@"hidden"] = @(item.hidden);
|
|
86
|
+
dict[@"preventsDefault"] = @(item.preventsDefault);
|
|
87
|
+
|
|
88
|
+
if (!item.testID.empty()) {
|
|
89
|
+
dict[@"testID"] = [NSString stringWithUTF8String:item.testID.c_str()];
|
|
90
|
+
}
|
|
91
|
+
if (!item.role.empty()) {
|
|
92
|
+
dict[@"role"] = [NSString stringWithUTF8String:item.role.c_str()];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
[result addObject:dict];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@interface RCTTabViewComponentView () <RCTRNCTabViewViewProtocol>
|
|
102
|
+
@end
|
|
103
|
+
|
|
104
|
+
@implementation RCTTabViewComponentView {
|
|
105
|
+
UIView *_containerView;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
109
|
+
{
|
|
110
|
+
return concreteComponentDescriptorProvider<RNCTabViewComponentDescriptor>();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
114
|
+
{
|
|
115
|
+
if (self = [super initWithFrame:frame]) {
|
|
116
|
+
static const auto defaultProps = std::make_shared<const RNCTabViewProps>();
|
|
117
|
+
_props = defaultProps;
|
|
118
|
+
|
|
119
|
+
Class containerClass = NSClassFromString(@"TabViewModule.RCTTabViewContainerView");
|
|
120
|
+
if (!containerClass) {
|
|
121
|
+
containerClass = NSClassFromString(@"RCTTabViewContainerView");
|
|
122
|
+
}
|
|
123
|
+
_containerView = [[containerClass alloc] init];
|
|
124
|
+
self.contentView = _containerView;
|
|
125
|
+
|
|
126
|
+
// Set up event forwarding from Swift container to Fabric EventEmitter.
|
|
127
|
+
// Swift container uses RCTDirectEventBlock (void (^)(NSDictionary *)) for events,
|
|
128
|
+
// but in Fabric mode we need to forward them through the C++ EventEmitter.
|
|
129
|
+
typedef void (^EventBlock)(NSDictionary *);
|
|
130
|
+
__weak auto weakSelf = self;
|
|
131
|
+
|
|
132
|
+
EventBlock onPageSelected = ^(NSDictionary *body) {
|
|
133
|
+
auto strongSelf = weakSelf;
|
|
134
|
+
if (!strongSelf) return;
|
|
135
|
+
auto emitter = std::static_pointer_cast<const RNCTabViewEventEmitter>(strongSelf->_eventEmitter);
|
|
136
|
+
if (emitter) {
|
|
137
|
+
emitter->onPageSelected({.key = std::string([[body objectForKey:@"key"] UTF8String] ?: "")});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
[_containerView setValue:onPageSelected forKey:@"onPageSelected"];
|
|
141
|
+
|
|
142
|
+
EventBlock onTabLongPress = ^(NSDictionary *body) {
|
|
143
|
+
auto strongSelf = weakSelf;
|
|
144
|
+
if (!strongSelf) return;
|
|
145
|
+
auto emitter = std::static_pointer_cast<const RNCTabViewEventEmitter>(strongSelf->_eventEmitter);
|
|
146
|
+
if (emitter) {
|
|
147
|
+
emitter->onTabLongPress({.key = std::string([[body objectForKey:@"key"] UTF8String] ?: "")});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
[_containerView setValue:onTabLongPress forKey:@"onTabLongPress"];
|
|
151
|
+
|
|
152
|
+
EventBlock onTabBarMeasured = ^(NSDictionary *body) {
|
|
153
|
+
auto strongSelf = weakSelf;
|
|
154
|
+
if (!strongSelf) return;
|
|
155
|
+
auto emitter = std::static_pointer_cast<const RNCTabViewEventEmitter>(strongSelf->_eventEmitter);
|
|
156
|
+
if (emitter) {
|
|
157
|
+
emitter->onTabBarMeasured({.height = [[body objectForKey:@"height"] intValue]});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
[_containerView setValue:onTabBarMeasured forKey:@"onTabBarMeasured"];
|
|
161
|
+
|
|
162
|
+
EventBlock onNativeLayout = ^(NSDictionary *body) {
|
|
163
|
+
auto strongSelf = weakSelf;
|
|
164
|
+
if (!strongSelf) return;
|
|
165
|
+
auto emitter = std::static_pointer_cast<const RNCTabViewEventEmitter>(strongSelf->_eventEmitter);
|
|
166
|
+
if (emitter) {
|
|
167
|
+
emitter->onNativeLayout({
|
|
168
|
+
.width = [[body objectForKey:@"width"] doubleValue],
|
|
169
|
+
.height = [[body objectForKey:@"height"] doubleValue]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
[_containerView setValue:onNativeLayout forKey:@"onNativeLayout"];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return self;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
+ (BOOL)shouldBeRecycled
|
|
180
|
+
{
|
|
181
|
+
return NO;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
|
|
185
|
+
SEL sel = @selector(insertChild:atIndex:);
|
|
186
|
+
if ([_containerView respondsToSelector:sel]) {
|
|
187
|
+
NSMethodSignature *sig = [_containerView methodSignatureForSelector:sel];
|
|
188
|
+
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig];
|
|
189
|
+
[inv setSelector:sel];
|
|
190
|
+
[inv setTarget:_containerView];
|
|
191
|
+
UIView *child = childComponentView;
|
|
192
|
+
[inv setArgument:&child atIndex:2];
|
|
193
|
+
[inv setArgument:&index atIndex:3];
|
|
194
|
+
[inv invoke];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
|
|
199
|
+
SEL sel = @selector(removeChildAtIndex:);
|
|
200
|
+
if ([_containerView respondsToSelector:sel]) {
|
|
201
|
+
NSMethodSignature *sig = [_containerView methodSignatureForSelector:sel];
|
|
202
|
+
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig];
|
|
203
|
+
[inv setSelector:sel];
|
|
204
|
+
[inv setTarget:_containerView];
|
|
205
|
+
[inv setArgument:&index atIndex:2];
|
|
206
|
+
[inv invoke];
|
|
207
|
+
}
|
|
208
|
+
[childComponentView removeFromSuperview];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
212
|
+
{
|
|
213
|
+
const auto &oldViewProps = *std::static_pointer_cast<RNCTabViewProps const>(_props);
|
|
214
|
+
const auto &newViewProps = *std::static_pointer_cast<RNCTabViewProps const>(props);
|
|
215
|
+
|
|
216
|
+
#define SET_PROP(prop, value) \
|
|
217
|
+
if ([_containerView respondsToSelector:@selector(setProp:)]) { \
|
|
218
|
+
[_containerView setValue:value forKey:@#prop]; \
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (oldViewProps.items != newViewProps.items) {
|
|
222
|
+
[_containerView setValue:convertItemsToArray(newViewProps.items) forKey:@"items"];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (oldViewProps.translucent != newViewProps.translucent) {
|
|
226
|
+
[_containerView setValue:@(newViewProps.translucent) forKey:@"translucent"];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (oldViewProps.icons != newViewProps.icons) {
|
|
230
|
+
auto iconsArray = [[NSMutableArray alloc] init];
|
|
231
|
+
for (auto &source: newViewProps.icons) {
|
|
232
|
+
NSMutableDictionary *iconDict = [NSMutableDictionary dictionary];
|
|
233
|
+
iconDict[@"uri"] = [NSString stringWithUTF8String:source.uri.c_str()];
|
|
234
|
+
iconDict[@"width"] = @(source.size.width);
|
|
235
|
+
iconDict[@"height"] = @(source.size.height);
|
|
236
|
+
iconDict[@"scale"] = @(source.scale);
|
|
237
|
+
[iconsArray addObject:iconDict];
|
|
238
|
+
}
|
|
239
|
+
[_containerView setValue:iconsArray forKey:@"icons"];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (oldViewProps.sidebarAdaptable != newViewProps.sidebarAdaptable) {
|
|
243
|
+
[_containerView setValue:@(newViewProps.sidebarAdaptable) forKey:@"sidebarAdaptable"];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (oldViewProps.minimizeBehavior != newViewProps.minimizeBehavior) {
|
|
247
|
+
[_containerView setValue:NSStringFromStdStringNilIfEmpty(newViewProps.minimizeBehavior) forKey:@"minimizeBehavior"];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (oldViewProps.disablePageAnimations != newViewProps.disablePageAnimations) {
|
|
251
|
+
[_containerView setValue:@(newViewProps.disablePageAnimations) forKey:@"disablePageAnimations"];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (oldViewProps.labeled != newViewProps.labeled) {
|
|
255
|
+
[_containerView setValue:@(newViewProps.labeled) forKey:@"labeled"];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (oldViewProps.selectedPage != newViewProps.selectedPage) {
|
|
259
|
+
[_containerView setValue:[NSString stringWithUTF8String:newViewProps.selectedPage.c_str()] forKey:@"selectedPage"];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (oldViewProps.scrollEdgeAppearance != newViewProps.scrollEdgeAppearance) {
|
|
263
|
+
[_containerView setValue:NSStringFromStdStringNilIfEmpty(newViewProps.scrollEdgeAppearance) forKey:@"scrollEdgeAppearance"];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (oldViewProps.barTintColor != newViewProps.barTintColor) {
|
|
267
|
+
[_containerView setValue:RCTUIColorFromSharedColor(newViewProps.barTintColor) forKey:@"barTintColor"];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (oldViewProps.activeTintColor != newViewProps.activeTintColor) {
|
|
271
|
+
[_containerView setValue:RCTUIColorFromSharedColor(newViewProps.activeTintColor) forKey:@"activeTintColor"];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (oldViewProps.inactiveTintColor != newViewProps.inactiveTintColor) {
|
|
275
|
+
[_containerView setValue:RCTUIColorFromSharedColor(newViewProps.inactiveTintColor) forKey:@"inactiveTintColor"];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (oldViewProps.hapticFeedbackEnabled != newViewProps.hapticFeedbackEnabled) {
|
|
279
|
+
[_containerView setValue:@(newViewProps.hapticFeedbackEnabled) forKey:@"hapticFeedbackEnabled"];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (oldViewProps.fontSize != newViewProps.fontSize) {
|
|
283
|
+
[_containerView setValue:@(newViewProps.fontSize) forKey:@"fontSize"];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (oldViewProps.fontWeight != newViewProps.fontWeight) {
|
|
287
|
+
[_containerView setValue:NSStringFromStdStringNilIfEmpty(newViewProps.fontWeight) forKey:@"fontWeight"];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (oldViewProps.fontFamily != newViewProps.fontFamily) {
|
|
291
|
+
[_containerView setValue:NSStringFromStdStringNilIfEmpty(newViewProps.fontFamily) forKey:@"fontFamily"];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (oldViewProps.tabBarHidden != newViewProps.tabBarHidden) {
|
|
295
|
+
[_containerView setValue:@(newViewProps.tabBarHidden) forKey:@"tabBarHidden"];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#undef SET_PROP
|
|
299
|
+
|
|
300
|
+
[super updateProps:props oldProps:oldProps];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
- (void)updateState:(const facebook::react::State::Shared &)state oldState:(const facebook::react::State::Shared &)oldState
|
|
304
|
+
{
|
|
305
|
+
auto _state = std::static_pointer_cast<RNCTabViewShadowNode::ConcreteState const>(state);
|
|
306
|
+
auto data = _state->getData();
|
|
307
|
+
if (auto imgLoaderPtr = _state.get()->getData().getImageLoader().lock()) {
|
|
308
|
+
id imageLoader = unwrapManagedObject(imgLoaderPtr);
|
|
309
|
+
if ([_containerView respondsToSelector:@selector(setImageLoader:)]) {
|
|
310
|
+
[_containerView performSelector:@selector(setImageLoader:) withObject:imageLoader];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
- (void)prepareForRecycle
|
|
316
|
+
{
|
|
317
|
+
[super prepareForRecycle];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
@end
|
|
321
|
+
|
|
322
|
+
Class<RCTComponentViewProtocol> RNCTabViewCls(void)
|
|
323
|
+
{
|
|
324
|
+
return RCTTabViewComponentView.class;
|
|
325
|
+
}
|