react-native-screens 4.12.0 → 4.13.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/RNScreens.podspec +29 -2
- package/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt +4 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +9 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenFragmentWrapper.kt +0 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +4 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreensModule.kt +1 -1
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/DimmingView.kt +4 -4
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/DimmingViewManager.kt +8 -2
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenAnimationDelegate.kt +1 -2
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenEventEmitter.kt +16 -13
- package/android/src/main/java/com/swmansion/rnscreens/gamma/common/BaseEventEmitter.kt +22 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/common/FragmentProviding.kt +11 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/common/NamingAwareEventType.kt +13 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/helpers/EventHelpers.kt +6 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/helpers/FragmentManagerHelper.kt +76 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/helpers/SystemDrawable.kt +33 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreen.kt +101 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenDelegate.kt +17 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenEventEmitter.kt +46 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenFragment.kt +37 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenViewManager.kt +178 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHost.kt +433 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHostEventEmitter.kt +14 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHostViewManager.kt +177 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenDidAppearEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenDidDisappearEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenWillAppearEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenWillDisappearEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabsHostNativeFocusChangeEvent.kt +36 -0
- package/android/src/main/java/com/swmansion/rnscreens/stack/views/ChildDrawingOrderStrategyImpl.kt +0 -1
- package/android/src/main/java/com/swmansion/rnscreens/transition/ExternalBoundaryValuesEvaluator.kt +9 -2
- package/android/src/main/java/com/swmansion/rnscreens/utils/FragmentTransactionKt.kt +4 -1
- package/android/src/main/jni/rnscreens.h +1 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsManagerDelegate.java +76 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsManagerInterface.java +33 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsScreenManagerDelegate.java +97 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsScreenManagerInterface.java +40 -0
- package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledHeaderConfigViewGroup.kt +2 -2
- package/android/src/versioned/backgroundcolor/76/ViewBackgroundUtils.kt +0 -1
- package/android/src/versioned/backgroundcolor/latest/ViewBackgroundUtils.kt +0 -3
- package/android/src/versioned/pointerevents/77/com/swmansion/rnscreens/PointerEventsBoxNoneImpl.kt +1 -1
- package/android/src/versioned/pointerevents/latest/com/swmansion/rnscreens/PointerEventsBoxNoneImpl.kt +1 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsComponentDescriptor.h +31 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsShadowNode.cpp +20 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsShadowNode.h +32 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsState.cpp +22 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsState.h +44 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +8 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenComponentDescriptor.h +40 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenShadowNode.cpp +13 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenShadowNode.h +36 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenState.h +32 -0
- package/cpp/RNScreensTurboModule.h +5 -0
- package/ios/RNSEnums.h +6 -0
- package/ios/RNSScreen.h +2 -1
- package/ios/RNSScreen.mm +48 -1
- package/ios/RNSScreenContainer.mm +6 -0
- package/ios/RNSScreenStack.h +3 -1
- package/ios/RNSScreenStack.mm +39 -2
- package/ios/RNSScreenStackHeaderConfig.mm +1 -1
- package/ios/RNSScrollViewBehaviorOverriding.h +24 -0
- package/ios/RNSScrollViewFinder.h +13 -0
- package/ios/RNSScrollViewFinder.mm +22 -0
- package/ios/RNSScrollViewHelper.h +10 -0
- package/ios/RNSScrollViewHelper.mm +15 -0
- package/ios/RNScreens-Bridging-Header.h +4 -0
- package/ios/UIScrollView+RNScreens.h +14 -0
- package/ios/UIScrollView+RNScreens.mm +15 -0
- package/ios/bottom-tabs/RCTConvert+RNSBottomTabs.h +18 -0
- package/ios/bottom-tabs/RCTConvert+RNSBottomTabs.mm +25 -0
- package/ios/bottom-tabs/RNSBottomTabsHostComponentView.h +80 -0
- package/ios/bottom-tabs/RNSBottomTabsHostComponentView.mm +486 -0
- package/ios/bottom-tabs/RNSBottomTabsHostComponentViewManager.h +11 -0
- package/ios/bottom-tabs/RNSBottomTabsHostComponentViewManager.mm +48 -0
- package/ios/bottom-tabs/RNSBottomTabsHostEventEmitter.h +53 -0
- package/ios/bottom-tabs/RNSBottomTabsHostEventEmitter.mm +57 -0
- package/ios/bottom-tabs/RNSBottomTabsScreenComponentView.h +95 -0
- package/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm +492 -0
- package/ios/bottom-tabs/RNSBottomTabsScreenComponentViewManager.h +9 -0
- package/ios/bottom-tabs/RNSBottomTabsScreenComponentViewManager.mm +55 -0
- package/ios/bottom-tabs/RNSBottomTabsScreenEventEmitter.h +53 -0
- package/ios/bottom-tabs/RNSBottomTabsScreenEventEmitter.mm +106 -0
- package/ios/bottom-tabs/RNSBottomTabsSpecialEffectsSupporting.h +17 -0
- package/ios/bottom-tabs/RNSTabBarAppearanceCoordinator.h +34 -0
- package/ios/bottom-tabs/RNSTabBarAppearanceCoordinator.mm +243 -0
- package/ios/bottom-tabs/RNSTabBarAppearanceProvider.h +23 -0
- package/ios/bottom-tabs/RNSTabBarController.h +132 -0
- package/ios/bottom-tabs/RNSTabBarController.mm +206 -0
- package/ios/bottom-tabs/RNSTabBarControllerDelegate.h +9 -0
- package/ios/bottom-tabs/RNSTabBarControllerDelegate.mm +63 -0
- package/ios/bottom-tabs/RNSTabsScreenViewController.h +42 -0
- package/ios/bottom-tabs/RNSTabsScreenViewController.mm +105 -0
- package/ios/bottom-tabs/extensions/RNSBottomTabsHostComponentView+RNSImageLoader.h +21 -0
- package/ios/bottom-tabs/extensions/RNSBottomTabsHostComponentView+RNSImageLoader.mm +22 -0
- package/ios/bridging/RNSReactBaseView.h +31 -0
- package/ios/bridging/RNSReactBaseView.mm +5 -0
- package/ios/bridging/Swift-Bridging.h +7 -0
- package/ios/conversion/RNSConversions-BottomTabs.mm +216 -0
- package/ios/conversion/RNSConversions-SplitView.mm +63 -0
- package/ios/conversion/RNSConversions.h +53 -0
- package/ios/gamma/ReactMountingTransactionObserving.swift +7 -0
- package/ios/gamma/split-view/RNSSplitViewHostComponentView.h +29 -0
- package/ios/gamma/split-view/RNSSplitViewHostComponentView.mm +209 -0
- package/ios/gamma/split-view/RNSSplitViewHostComponentViewManager.h +11 -0
- package/ios/gamma/split-view/RNSSplitViewHostComponentViewManager.mm +7 -0
- package/ios/gamma/split-view/RNSSplitViewHostController.swift +98 -0
- package/ios/gamma/split-view/RNSSplitViewNavigationController.swift +31 -0
- package/ios/gamma/split-view/RNSSplitViewScreenComponentView.h +24 -0
- package/ios/gamma/split-view/RNSSplitViewScreenComponentView.mm +106 -0
- package/ios/gamma/split-view/RNSSplitViewScreenComponentViewManager.h +11 -0
- package/ios/gamma/split-view/RNSSplitViewScreenComponentViewManager.mm +7 -0
- package/ios/gamma/split-view/RNSSplitViewScreenController.swift +86 -0
- package/ios/gamma/split-view/RNSSplitViewScreenShadowStateProxy.h +35 -0
- package/ios/gamma/split-view/RNSSplitViewScreenShadowStateProxy.mm +56 -0
- package/ios/gamma/stack/RNSScreenStackHostComponentView.h +16 -0
- package/ios/gamma/stack/RNSScreenStackHostComponentView.mm +143 -0
- package/ios/gamma/stack/RNSScreenStackHostComponentViewManager.h +11 -0
- package/ios/gamma/stack/RNSScreenStackHostComponentViewManager.mm +7 -0
- package/ios/gamma/stack/RNSStackController.swift +65 -0
- package/ios/gamma/stack/RNSStackScreenComponentEventEmitter.h +37 -0
- package/ios/gamma/stack/RNSStackScreenComponentEventEmitter.mm +60 -0
- package/ios/gamma/stack/RNSStackScreenComponentView.h +36 -0
- package/ios/gamma/stack/RNSStackScreenComponentView.mm +124 -0
- package/ios/gamma/stack/RNSStackScreenComponentViewManager.h +11 -0
- package/ios/gamma/stack/RNSStackScreenComponentViewManager.mm +7 -0
- package/ios/gamma/stack/RNSStackScreenController.swift +56 -0
- package/ios/utils/NSString+RNSUtility.h +17 -0
- package/ios/utils/NSString+RNSUtility.mm +37 -0
- package/lib/commonjs/components/BottomTabs.js +54 -0
- package/lib/commonjs/components/BottomTabs.js.map +1 -0
- package/lib/commonjs/components/BottomTabsScreen.js +149 -0
- package/lib/commonjs/components/BottomTabsScreen.js.map +1 -0
- package/lib/commonjs/components/gamma/ScreenStackHost.js +27 -0
- package/lib/commonjs/components/gamma/ScreenStackHost.js.map +1 -0
- package/lib/commonjs/components/gamma/SplitViewHost.js +57 -0
- package/lib/commonjs/components/gamma/SplitViewHost.js.map +1 -0
- package/lib/commonjs/components/gamma/SplitViewScreen.js +22 -0
- package/lib/commonjs/components/gamma/SplitViewScreen.js.map +1 -0
- package/lib/commonjs/components/gamma/StackScreen.js +51 -0
- package/lib/commonjs/components/gamma/StackScreen.js.map +1 -0
- package/lib/commonjs/fabric/BottomTabsNativeComponent.js +19 -0
- package/lib/commonjs/fabric/BottomTabsNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/BottomTabsScreenNativeComponent.js +14 -0
- package/lib/commonjs/fabric/BottomTabsScreenNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/gamma/ScreenStackHostNativeComponent.js +11 -0
- package/lib/commonjs/fabric/gamma/ScreenStackHostNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/gamma/SplitViewHostNativeComponent.js +11 -0
- package/lib/commonjs/fabric/gamma/SplitViewHostNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/gamma/SplitViewScreenNativeComponent.js +13 -0
- package/lib/commonjs/fabric/gamma/SplitViewScreenNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/gamma/StackScreenNativeComponent.js +12 -0
- package/lib/commonjs/fabric/gamma/StackScreenNativeComponent.js.map +1 -0
- package/lib/commonjs/flags.js +70 -0
- package/lib/commonjs/flags.js.map +1 -0
- package/lib/commonjs/index.js +66 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +0 -28
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/components/BottomTabs.js +48 -0
- package/lib/module/components/BottomTabs.js.map +1 -0
- package/lib/module/components/BottomTabsScreen.js +144 -0
- package/lib/module/components/BottomTabsScreen.js.map +1 -0
- package/lib/module/components/gamma/ScreenStackHost.js +20 -0
- package/lib/module/components/gamma/ScreenStackHost.js.map +1 -0
- package/lib/module/components/gamma/SplitViewHost.js +50 -0
- package/lib/module/components/gamma/SplitViewHost.js.map +1 -0
- package/lib/module/components/gamma/SplitViewScreen.js +15 -0
- package/lib/module/components/gamma/SplitViewScreen.js.map +1 -0
- package/lib/module/components/gamma/StackScreen.js +44 -0
- package/lib/module/components/gamma/StackScreen.js.map +1 -0
- package/lib/module/fabric/BottomTabsNativeComponent.js +15 -0
- package/lib/module/fabric/BottomTabsNativeComponent.js.map +1 -0
- package/lib/module/fabric/BottomTabsScreenNativeComponent.js +12 -0
- package/lib/module/fabric/BottomTabsScreenNativeComponent.js.map +1 -0
- package/lib/module/fabric/gamma/ScreenStackHostNativeComponent.js +5 -0
- package/lib/module/fabric/gamma/ScreenStackHostNativeComponent.js.map +1 -0
- package/lib/module/fabric/gamma/SplitViewHostNativeComponent.js +5 -0
- package/lib/module/fabric/gamma/SplitViewHostNativeComponent.js.map +1 -0
- package/lib/module/fabric/gamma/SplitViewScreenNativeComponent.js +7 -0
- package/lib/module/fabric/gamma/SplitViewScreenNativeComponent.js.map +1 -0
- package/lib/module/fabric/gamma/StackScreenNativeComponent.js +8 -0
- package/lib/module/fabric/gamma/StackScreenNativeComponent.js.map +1 -0
- package/lib/module/flags.js +64 -0
- package/lib/module/flags.js.map +1 -0
- package/lib/module/index.js +16 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +0 -27
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/components/BottomTabs.d.ts +30 -0
- package/lib/typescript/components/BottomTabs.d.ts.map +1 -0
- package/lib/typescript/components/BottomTabsScreen.d.ts +56 -0
- package/lib/typescript/components/BottomTabsScreen.d.ts.map +1 -0
- package/lib/typescript/components/gamma/ScreenStackHost.d.ts +13 -0
- package/lib/typescript/components/gamma/ScreenStackHost.d.ts.map +1 -0
- package/lib/typescript/components/gamma/SplitViewHost.d.ts +13 -0
- package/lib/typescript/components/gamma/SplitViewHost.d.ts.map +1 -0
- package/lib/typescript/components/gamma/SplitViewScreen.d.ts +13 -0
- package/lib/typescript/components/gamma/SplitViewScreen.d.ts.map +1 -0
- package/lib/typescript/components/gamma/StackScreen.d.ts +21 -0
- package/lib/typescript/components/gamma/StackScreen.d.ts.map +1 -0
- package/lib/typescript/fabric/BottomTabsNativeComponent.d.ts +31 -0
- package/lib/typescript/fabric/BottomTabsNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/BottomTabsScreenNativeComponent.d.ts +51 -0
- package/lib/typescript/fabric/BottomTabsScreenNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/gamma/ScreenStackHostNativeComponent.d.ts +7 -0
- package/lib/typescript/fabric/gamma/ScreenStackHostNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/gamma/SplitViewHostNativeComponent.d.ts +16 -0
- package/lib/typescript/fabric/gamma/SplitViewHostNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/gamma/SplitViewScreenNativeComponent.d.ts +7 -0
- package/lib/typescript/fabric/gamma/SplitViewScreenNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/gamma/StackScreenNativeComponent.d.ts +15 -0
- package/lib/typescript/fabric/gamma/StackScreenNativeComponent.d.ts.map +1 -0
- package/lib/typescript/flags.d.ts +45 -0
- package/lib/typescript/flags.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +14 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +0 -26
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +34 -6
- package/react-native.config.js +2 -1
- package/src/components/BottomTabs.tsx +115 -0
- package/src/components/BottomTabsScreen.tsx +291 -0
- package/src/components/gamma/ScreenStackHost.tsx +32 -0
- package/src/components/gamma/SplitViewHost.tsx +84 -0
- package/src/components/gamma/SplitViewScreen.tsx +26 -0
- package/src/components/gamma/StackScreen.tsx +64 -0
- package/src/fabric/BottomTabsNativeComponent.ts +82 -0
- package/src/fabric/BottomTabsScreenNativeComponent.ts +107 -0
- package/src/fabric/gamma/ScreenStackHostNativeComponent.ts +8 -0
- package/src/fabric/gamma/SplitViewHostNativeComponent.ts +39 -0
- package/src/fabric/gamma/SplitViewScreenNativeComponent.ts +10 -0
- package/src/fabric/gamma/StackScreenNativeComponent.ts +25 -0
- package/src/flags.ts +72 -0
- package/src/index.tsx +18 -1
- package/src/utils.ts +0 -28
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
// Hide C++ symbols from C compiler used when building Swift module
|
|
4
|
+
#if defined(__cplusplus) && RCT_NEW_ARCH_ENABLED
|
|
5
|
+
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
6
|
+
|
|
7
|
+
namespace react = facebook::react;
|
|
8
|
+
#endif // __cplusplus
|
|
9
|
+
|
|
10
|
+
#if !RCT_NEW_ARCH_ENABLED
|
|
11
|
+
#import <React/RCTComponent.h>
|
|
12
|
+
#endif // !RCT_NEW_ARCH_ENABLED
|
|
13
|
+
|
|
14
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
15
|
+
|
|
16
|
+
#if defined(__cplusplus)
|
|
17
|
+
struct OnNativeFocusChangePayload {
|
|
18
|
+
NSString *_Nonnull tabKey;
|
|
19
|
+
};
|
|
20
|
+
#else
|
|
21
|
+
typedef struct {
|
|
22
|
+
NSString *_Nonnull tabKey;
|
|
23
|
+
} OnNativeFocusChangePayload;
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
@interface RNSBottomTabsHostEventEmitter : NSObject
|
|
27
|
+
|
|
28
|
+
- (BOOL)emitOnNativeFocusChange:(OnNativeFocusChangePayload)payload;
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
#pragma mark - Hidden from Swift
|
|
33
|
+
|
|
34
|
+
#if defined(__cplusplus)
|
|
35
|
+
|
|
36
|
+
@interface RNSBottomTabsHostEventEmitter ()
|
|
37
|
+
|
|
38
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
39
|
+
|
|
40
|
+
- (void)updateEventEmitter:(const std::shared_ptr<const react::RNSBottomTabsEventEmitter> &)emitter;
|
|
41
|
+
|
|
42
|
+
#else
|
|
43
|
+
#pragma mark - LEGACY Event emitter blocks
|
|
44
|
+
|
|
45
|
+
@property (nonatomic, copy) RCTDirectEventBlock onNativeFocusChange;
|
|
46
|
+
|
|
47
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
48
|
+
|
|
49
|
+
@end
|
|
50
|
+
|
|
51
|
+
#endif // __cplusplus
|
|
52
|
+
|
|
53
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#import "RNSBottomTabsHostEventEmitter.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTLog.h>
|
|
4
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
5
|
+
#import <React/RCTConversions.h>
|
|
6
|
+
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
7
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
8
|
+
|
|
9
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
10
|
+
namespace react = facebook::react;
|
|
11
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
12
|
+
|
|
13
|
+
@implementation RNSBottomTabsHostEventEmitter {
|
|
14
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
15
|
+
std::shared_ptr<const react::RNSBottomTabsEventEmitter> _reactEventEmitter;
|
|
16
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
- (instancetype)init
|
|
20
|
+
{
|
|
21
|
+
if (self = [super init]) {
|
|
22
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
23
|
+
_reactEventEmitter = nullptr;
|
|
24
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
25
|
+
}
|
|
26
|
+
return self;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
30
|
+
- (void)updateEventEmitter:(const std::shared_ptr<const react::RNSBottomTabsEventEmitter> &)emitter
|
|
31
|
+
{
|
|
32
|
+
_reactEventEmitter = emitter;
|
|
33
|
+
}
|
|
34
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
35
|
+
|
|
36
|
+
- (BOOL)emitOnNativeFocusChange:(OnNativeFocusChangePayload)payload
|
|
37
|
+
{
|
|
38
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
39
|
+
if (_reactEventEmitter != nullptr) {
|
|
40
|
+
_reactEventEmitter->onNativeFocusChange({.tabKey = RCTStringFromNSString(payload.tabKey)});
|
|
41
|
+
return YES;
|
|
42
|
+
} else {
|
|
43
|
+
RCTLogWarn(@"[RNScreens] Skipped OnNativeFocusChange event emission due to nullish emitter");
|
|
44
|
+
return NO;
|
|
45
|
+
}
|
|
46
|
+
#else
|
|
47
|
+
if (self.onNativeFocusChange) {
|
|
48
|
+
self.onNativeFocusChange(@{@"tabKey" : payload.tabKey});
|
|
49
|
+
return YES;
|
|
50
|
+
} else {
|
|
51
|
+
RCTLogWarn(@"[RNScreens] Skipped OnNativeFocusChange event emission due to nullish emitter");
|
|
52
|
+
return NO;
|
|
53
|
+
}
|
|
54
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#import "RNSBottomTabsScreenEventEmitter.h"
|
|
2
|
+
#import "RNSEnums.h"
|
|
3
|
+
#import "RNSReactBaseView.h"
|
|
4
|
+
#import "RNSTabBarAppearanceProvider.h"
|
|
5
|
+
#import "RNSScrollViewBehaviorOverriding.h"
|
|
6
|
+
#import <React/RCTImageSource.h>
|
|
7
|
+
|
|
8
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
9
|
+
|
|
10
|
+
@class RNSBottomTabsHostComponentView;
|
|
11
|
+
@class RNSTabsScreenViewController;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component view with react managed lifecycle. This view serves as root view in hierarchy
|
|
15
|
+
* of a particular tab.
|
|
16
|
+
*/
|
|
17
|
+
@interface RNSBottomTabsScreenComponentView : RNSReactBaseView
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* View controller responsible for managing tab represented by this component view.
|
|
21
|
+
*/
|
|
22
|
+
@property (nonatomic, strong, readonly, nullable) RNSTabsScreenViewController *controller;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* If not null, the bottom tabs host view that this tab component view belongs to.
|
|
26
|
+
*/
|
|
27
|
+
@property (nonatomic, weak, nullable) RNSBottomTabsHostComponentView *reactSuperview;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
#pragma mark - Props
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Properties set on component in JavaScript.
|
|
35
|
+
*/
|
|
36
|
+
@interface RNSBottomTabsScreenComponentView () <RNSTabBarAppearanceProvider, RNSScrollViewBehaviorOverriding>
|
|
37
|
+
|
|
38
|
+
// TODO: All of these properties should be `readonly`. Do this when support for legacy
|
|
39
|
+
// architecture is dropped.
|
|
40
|
+
|
|
41
|
+
@property (nonatomic) BOOL isSelectedScreen;
|
|
42
|
+
@property (nonatomic, nullable) NSString *tabKey;
|
|
43
|
+
@property (nonatomic, nullable) NSString *badgeValue;
|
|
44
|
+
|
|
45
|
+
@property (nonatomic, strong, nullable) UIColor *tabBarBackgroundColor;
|
|
46
|
+
@property (nonatomic, strong, nullable) UIBlurEffect *tabBarBlurEffect;
|
|
47
|
+
|
|
48
|
+
@property (nonatomic, strong, nullable) NSString *tabBarItemTitleFontFamily;
|
|
49
|
+
@property (nonatomic, strong, nullable) NSNumber *tabBarItemTitleFontSize;
|
|
50
|
+
@property (nonatomic, strong, nullable) NSString *tabBarItemTitleFontWeight;
|
|
51
|
+
@property (nonatomic, strong, nullable) NSString *tabBarItemTitleFontStyle;
|
|
52
|
+
@property (nonatomic, strong, nullable) UIColor *tabBarItemTitleFontColor;
|
|
53
|
+
@property (nonatomic) UIOffset tabBarItemTitlePositionAdjustment;
|
|
54
|
+
|
|
55
|
+
@property (nonatomic, strong, nullable) UIColor *tabBarItemIconColor;
|
|
56
|
+
|
|
57
|
+
@property (nonatomic, readonly) RNSBottomTabsIconType iconType;
|
|
58
|
+
|
|
59
|
+
@property (nonatomic, strong, readonly, nullable) RCTImageSource *iconImageSource;
|
|
60
|
+
@property (nonatomic, strong, readonly, nullable) NSString *iconSfSymbolName;
|
|
61
|
+
|
|
62
|
+
@property (nonatomic, strong, readonly, nullable) RCTImageSource *selectedIconImageSource;
|
|
63
|
+
@property (nonatomic, strong, readonly, nullable) NSString *selectedIconSfSymbolName;
|
|
64
|
+
|
|
65
|
+
@property (nonatomic, nullable) UIColor *tabBarItemBadgeBackgroundColor;
|
|
66
|
+
|
|
67
|
+
@property (nonatomic, nullable) NSString *title;
|
|
68
|
+
|
|
69
|
+
@property (nonatomic) BOOL shouldUseRepeatedTabSelectionPopToRootSpecialEffect;
|
|
70
|
+
@property (nonatomic) BOOL shouldUseRepeatedTabSelectionScrollToTopSpecialEffect;
|
|
71
|
+
|
|
72
|
+
@property (nonatomic, readonly) BOOL overrideScrollViewContentInsetAdjustmentBehavior;
|
|
73
|
+
|
|
74
|
+
@end
|
|
75
|
+
|
|
76
|
+
#pragma mark - Events
|
|
77
|
+
|
|
78
|
+
@interface RNSBottomTabsScreenComponentView ()
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Use returned object to emit appropriate React Events to Element Tree.
|
|
82
|
+
*/
|
|
83
|
+
- (nonnull RNSBottomTabsScreenEventEmitter *)reactEventEmitter;
|
|
84
|
+
|
|
85
|
+
#if !RCT_NEW_ARCH_ENABLED
|
|
86
|
+
#pragma mark - LEGACY Event emitting blocks
|
|
87
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onWillAppear;
|
|
88
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onDidAppear;
|
|
89
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onWillDisappear;
|
|
90
|
+
@property (nonatomic, copy, nullable) RCTDirectEventBlock onDidDisappear;
|
|
91
|
+
#endif // !RCT_NEW_ARCH_ENABLED
|
|
92
|
+
|
|
93
|
+
@end
|
|
94
|
+
|
|
95
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
#import "RNSBottomTabsScreenComponentView.h"
|
|
2
|
+
#import "NSString+RNSUtility.h"
|
|
3
|
+
#import "RNSConversions.h"
|
|
4
|
+
#import "RNSDefines.h"
|
|
5
|
+
#import "RNSScrollViewHelper.h"
|
|
6
|
+
#import "RNSTabBarController.h"
|
|
7
|
+
|
|
8
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
9
|
+
#import <React/RCTConversions.h>
|
|
10
|
+
#import <React/RCTImageSource.h>
|
|
11
|
+
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
12
|
+
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
13
|
+
#import <react/renderer/components/rnscreens/Props.h>
|
|
14
|
+
#import <react/renderer/components/rnscreens/RCTComponentViewHelpers.h>
|
|
15
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
16
|
+
|
|
17
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
18
|
+
namespace react = facebook::react;
|
|
19
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
20
|
+
|
|
21
|
+
#pragma mark - View implementation
|
|
22
|
+
|
|
23
|
+
@implementation RNSBottomTabsScreenComponentView {
|
|
24
|
+
RNSTabsScreenViewController *_controller;
|
|
25
|
+
RNSBottomTabsHostComponentView *__weak _Nullable _reactSuperview;
|
|
26
|
+
|
|
27
|
+
RNSBottomTabsScreenEventEmitter *_Nonnull _reactEventEmitter;
|
|
28
|
+
|
|
29
|
+
// We need this information to warn users about dynamic changes to behavior being currently unsupported.
|
|
30
|
+
BOOL _isOverrideScrollViewContentInsetAdjustmentBehaviorSet;
|
|
31
|
+
#if !RCT_NEW_ARCH_ENABLED
|
|
32
|
+
BOOL _tabItemNeedsAppearanceUpdate;
|
|
33
|
+
#endif // !RCT_NEW_ARCH_ENABLED
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
37
|
+
{
|
|
38
|
+
if (self = [super initWithFrame:frame]) {
|
|
39
|
+
[self initState];
|
|
40
|
+
}
|
|
41
|
+
return self;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (void)initState
|
|
45
|
+
{
|
|
46
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
47
|
+
static const auto defaultProps = std::make_shared<const react::RNSBottomTabsScreenProps>();
|
|
48
|
+
_props = defaultProps;
|
|
49
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
50
|
+
|
|
51
|
+
_controller = [RNSTabsScreenViewController new];
|
|
52
|
+
_controller.view = self;
|
|
53
|
+
|
|
54
|
+
_reactSuperview = nil;
|
|
55
|
+
_reactEventEmitter = [RNSBottomTabsScreenEventEmitter new];
|
|
56
|
+
|
|
57
|
+
#if !RCT_NEW_ARCH_ENABLED
|
|
58
|
+
_tabItemNeedsAppearanceUpdate = NO;
|
|
59
|
+
#endif
|
|
60
|
+
[self resetProps];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void)resetProps
|
|
64
|
+
{
|
|
65
|
+
_isSelectedScreen = NO;
|
|
66
|
+
_badgeValue = nil;
|
|
67
|
+
_title = nil;
|
|
68
|
+
_tabBarBlurEffect = nil;
|
|
69
|
+
_tabBarBackgroundColor = nil;
|
|
70
|
+
|
|
71
|
+
_tabBarItemTitleFontFamily = nil;
|
|
72
|
+
_tabBarItemTitleFontSize = nil;
|
|
73
|
+
_tabBarItemTitleFontWeight = nil;
|
|
74
|
+
_tabBarItemTitleFontStyle = nil;
|
|
75
|
+
_tabBarItemTitleFontColor = nil;
|
|
76
|
+
_tabBarItemTitlePositionAdjustment = UIOffsetMake(0.0, 0.0);
|
|
77
|
+
|
|
78
|
+
_tabBarItemIconColor = nil;
|
|
79
|
+
|
|
80
|
+
_tabBarItemBadgeBackgroundColor = nil;
|
|
81
|
+
|
|
82
|
+
_shouldUseRepeatedTabSelectionPopToRootSpecialEffect = YES;
|
|
83
|
+
_shouldUseRepeatedTabSelectionScrollToTopSpecialEffect = YES;
|
|
84
|
+
|
|
85
|
+
_overrideScrollViewContentInsetAdjustmentBehavior = YES;
|
|
86
|
+
_isOverrideScrollViewContentInsetAdjustmentBehaviorSet = NO;
|
|
87
|
+
|
|
88
|
+
_iconType = RNSBottomTabsIconTypeSfSymbol;
|
|
89
|
+
|
|
90
|
+
_iconImageSource = nil;
|
|
91
|
+
_iconSfSymbolName = nil;
|
|
92
|
+
|
|
93
|
+
_selectedIconImageSource = nil;
|
|
94
|
+
_selectedIconSfSymbolName = nil;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
RNS_IGNORE_SUPER_CALL_BEGIN
|
|
98
|
+
- (nullable RNSBottomTabsHostComponentView *)reactSuperview
|
|
99
|
+
{
|
|
100
|
+
return _reactSuperview;
|
|
101
|
+
}
|
|
102
|
+
RNS_IGNORE_SUPER_CALL_END
|
|
103
|
+
|
|
104
|
+
#pragma mark - Events
|
|
105
|
+
|
|
106
|
+
- (nonnull RNSBottomTabsScreenEventEmitter *)reactEventEmitter
|
|
107
|
+
{
|
|
108
|
+
RCTAssert(_reactEventEmitter != nil, @"[RNScreens] Attempt to access uninitialized _reactEventEmitter");
|
|
109
|
+
return _reactEventEmitter;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
- (nullable RNSTabBarController *)findTabBarController
|
|
113
|
+
{
|
|
114
|
+
return static_cast<RNSTabBarController *>(_controller.tabBarController);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#pragma mark - RNSScrollViewBehaviorOverriding
|
|
118
|
+
|
|
119
|
+
- (BOOL)shouldOverrideScrollViewContentInsetAdjustmentBehavior
|
|
120
|
+
{
|
|
121
|
+
return self.overrideScrollViewContentInsetAdjustmentBehavior;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
- (void)overrideScrollViewBehaviorInFirstDescendantChainIfNeeded
|
|
125
|
+
{
|
|
126
|
+
if ([self shouldOverrideScrollViewContentInsetAdjustmentBehavior]) {
|
|
127
|
+
[RNSScrollViewHelper overrideScrollViewBehaviorInFirstDescendantChainFrom:self];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
132
|
+
#pragma mark - RCTViewComponentViewProtocol
|
|
133
|
+
|
|
134
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
135
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
136
|
+
{
|
|
137
|
+
const auto &oldComponentProps = *std::static_pointer_cast<const react::RNSBottomTabsScreenProps>(_props);
|
|
138
|
+
const auto &newComponentProps = *std::static_pointer_cast<const react::RNSBottomTabsScreenProps>(props);
|
|
139
|
+
|
|
140
|
+
bool tabItemNeedsAppearanceUpdate{false};
|
|
141
|
+
|
|
142
|
+
if (newComponentProps.title != oldComponentProps.title) {
|
|
143
|
+
_title = RCTNSStringFromStringNilIfEmpty(newComponentProps.title);
|
|
144
|
+
_controller.title = _title;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (newComponentProps.tabKey != oldComponentProps.tabKey) {
|
|
148
|
+
RCTAssert(!newComponentProps.tabKey.empty(), @"[RNScreens] tabKey must not be empty!");
|
|
149
|
+
_tabKey = RCTNSStringFromString(newComponentProps.tabKey);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (newComponentProps.isFocused != oldComponentProps.isFocused) {
|
|
153
|
+
_isSelectedScreen = newComponentProps.isFocused;
|
|
154
|
+
[_controller tabScreenFocusHasChanged];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (newComponentProps.badgeValue != oldComponentProps.badgeValue) {
|
|
158
|
+
_badgeValue = RCTNSStringFromStringNilIfEmpty(newComponentProps.badgeValue);
|
|
159
|
+
_controller.tabBarItem.badgeValue = _badgeValue;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (newComponentProps.tabBarItemBadgeBackgroundColor != oldComponentProps.tabBarItemBadgeBackgroundColor) {
|
|
163
|
+
_tabBarItemBadgeBackgroundColor = RCTUIColorFromSharedColor(newComponentProps.tabBarItemBadgeBackgroundColor);
|
|
164
|
+
// Note that this will prevent default color from being set.
|
|
165
|
+
// TODO: support default color by setting nil here.
|
|
166
|
+
NSLog(@"TabsScreen [%ld] update badgeColor to %@", self.tag, _tabBarItemBadgeBackgroundColor);
|
|
167
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (newComponentProps.tabBarBackgroundColor != oldComponentProps.tabBarBackgroundColor) {
|
|
171
|
+
_tabBarBackgroundColor = RCTUIColorFromSharedColor(newComponentProps.tabBarBackgroundColor);
|
|
172
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (newComponentProps.tabBarBlurEffect != oldComponentProps.tabBarBlurEffect) {
|
|
176
|
+
_tabBarBlurEffect = rnscreens::conversion::RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(
|
|
177
|
+
newComponentProps.tabBarBlurEffect);
|
|
178
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (newComponentProps.tabBarItemTitleFontFamily != oldComponentProps.tabBarItemTitleFontFamily) {
|
|
182
|
+
_tabBarItemTitleFontFamily = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontFamily);
|
|
183
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (newComponentProps.tabBarItemTitleFontSize != oldComponentProps.tabBarItemTitleFontSize) {
|
|
187
|
+
_tabBarItemTitleFontSize = [NSNumber numberWithFloat:newComponentProps.tabBarItemTitleFontSize];
|
|
188
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (newComponentProps.tabBarItemTitleFontWeight != oldComponentProps.tabBarItemTitleFontWeight) {
|
|
192
|
+
_tabBarItemTitleFontWeight = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontWeight);
|
|
193
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (newComponentProps.tabBarItemTitleFontStyle != oldComponentProps.tabBarItemTitleFontStyle) {
|
|
197
|
+
_tabBarItemTitleFontStyle = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontStyle);
|
|
198
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (newComponentProps.tabBarItemTitleFontColor != oldComponentProps.tabBarItemTitleFontColor) {
|
|
202
|
+
_tabBarItemTitleFontColor = RCTUIColorFromSharedColor(newComponentProps.tabBarItemTitleFontColor);
|
|
203
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (newComponentProps.tabBarItemTitlePositionAdjustment.horizontal !=
|
|
207
|
+
oldComponentProps.tabBarItemTitlePositionAdjustment.horizontal ||
|
|
208
|
+
newComponentProps.tabBarItemTitlePositionAdjustment.vertical !=
|
|
209
|
+
oldComponentProps.tabBarItemTitlePositionAdjustment.vertical) {
|
|
210
|
+
_tabBarItemTitlePositionAdjustment =
|
|
211
|
+
rnscreens::conversion::RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct(
|
|
212
|
+
newComponentProps.tabBarItemTitlePositionAdjustment);
|
|
213
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (newComponentProps.tabBarItemIconColor != oldComponentProps.tabBarItemIconColor) {
|
|
217
|
+
_tabBarItemIconColor = RCTUIColorFromSharedColor(newComponentProps.tabBarItemIconColor);
|
|
218
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (newComponentProps.iconType != oldComponentProps.iconType) {
|
|
222
|
+
_iconType = rnscreens::conversion::RNSBottomTabsIconTypeFromIcon(newComponentProps.iconType);
|
|
223
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (newComponentProps.iconImageSource != oldComponentProps.iconImageSource) {
|
|
227
|
+
_iconImageSource =
|
|
228
|
+
rnscreens::conversion::RCTImageSourceFromImageSourceAndIconType(&newComponentProps.iconImageSource, _iconType);
|
|
229
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (newComponentProps.iconSfSymbolName != oldComponentProps.iconSfSymbolName) {
|
|
233
|
+
_iconSfSymbolName = RCTNSStringFromStringNilIfEmpty(newComponentProps.iconSfSymbolName);
|
|
234
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (newComponentProps.selectedIconImageSource != oldComponentProps.selectedIconImageSource) {
|
|
238
|
+
_selectedIconImageSource =
|
|
239
|
+
rnscreens::conversion::RCTImageSourceFromImageSourceAndIconType(&newComponentProps.selectedIconImageSource, _iconType);
|
|
240
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (newComponentProps.selectedIconSfSymbolName != oldComponentProps.selectedIconSfSymbolName) {
|
|
244
|
+
_selectedIconSfSymbolName = RCTNSStringFromStringNilIfEmpty(newComponentProps.selectedIconSfSymbolName);
|
|
245
|
+
tabItemNeedsAppearanceUpdate = YES;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (newComponentProps.specialEffects.repeatedTabSelection.popToRoot !=
|
|
249
|
+
oldComponentProps.specialEffects.repeatedTabSelection.popToRoot) {
|
|
250
|
+
_shouldUseRepeatedTabSelectionPopToRootSpecialEffect =
|
|
251
|
+
newComponentProps.specialEffects.repeatedTabSelection.popToRoot;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (newComponentProps.specialEffects.repeatedTabSelection.scrollToTop !=
|
|
255
|
+
oldComponentProps.specialEffects.repeatedTabSelection.scrollToTop) {
|
|
256
|
+
_shouldUseRepeatedTabSelectionScrollToTopSpecialEffect =
|
|
257
|
+
newComponentProps.specialEffects.repeatedTabSelection.scrollToTop;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (newComponentProps.overrideScrollViewContentInsetAdjustmentBehavior !=
|
|
261
|
+
oldComponentProps.overrideScrollViewContentInsetAdjustmentBehavior) {
|
|
262
|
+
_overrideScrollViewContentInsetAdjustmentBehavior =
|
|
263
|
+
newComponentProps.overrideScrollViewContentInsetAdjustmentBehavior;
|
|
264
|
+
|
|
265
|
+
if (_isOverrideScrollViewContentInsetAdjustmentBehaviorSet) {
|
|
266
|
+
RCTLogWarn(
|
|
267
|
+
@"[RNScreens] changing overrideScrollViewContentInsetAdjustmentBehavior dynamically is currently unsupported");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// This flag is set to YES when overrideScrollViewContentInsetAdjustmentBehavior prop
|
|
272
|
+
// is assigned for the first time. This allows us to identify any subsequent changes to this prop,
|
|
273
|
+
// enabling us to warn users that dynamic changes are not supported.
|
|
274
|
+
_isOverrideScrollViewContentInsetAdjustmentBehaviorSet = YES;
|
|
275
|
+
|
|
276
|
+
if (tabItemNeedsAppearanceUpdate) {
|
|
277
|
+
[_controller tabItemAppearanceHasChanged];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
[super updateProps:props oldProps:oldProps];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
- (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
|
|
284
|
+
oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics
|
|
285
|
+
{
|
|
286
|
+
NSLog(
|
|
287
|
+
@"TabScreen [%ld] updateLayoutMetrics: %@", self.tag, NSStringFromCGRect(RCTCGRectFromRect(layoutMetrics.frame)));
|
|
288
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
- (void)updateEventEmitter:(const facebook::react::EventEmitter::Shared &)eventEmitter
|
|
292
|
+
{
|
|
293
|
+
[super updateEventEmitter:eventEmitter];
|
|
294
|
+
[_reactEventEmitter
|
|
295
|
+
updateEventEmitter:std::static_pointer_cast<const react::RNSBottomTabsScreenEventEmitter>(eventEmitter)];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
299
|
+
{
|
|
300
|
+
NSLog(@"TabScreen [%ld] mount [%ld] at %ld", self.tag, childComponentView.tag, index);
|
|
301
|
+
[super mountChildComponentView:childComponentView index:index];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
305
|
+
{
|
|
306
|
+
NSLog(@"TabScreen [%ld] unmount [%ld] from %ld", self.tag, childComponentView.tag, index);
|
|
307
|
+
[super unmountChildComponentView:childComponentView index:index];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
311
|
+
{
|
|
312
|
+
return react::concreteComponentDescriptorProvider<react::RNSBottomTabsScreenComponentDescriptor>();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
+ (BOOL)shouldBeRecycled
|
|
316
|
+
{
|
|
317
|
+
// There won't be tens of instances of this component usually & it's easier for now.
|
|
318
|
+
// We could consider enabling it someday though.
|
|
319
|
+
return NO;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
#else
|
|
323
|
+
|
|
324
|
+
#pragma mark - LEGACY RCTComponent protocol
|
|
325
|
+
|
|
326
|
+
- (void)didSetProps:(NSArray<NSString *> *)changedProps
|
|
327
|
+
{
|
|
328
|
+
[super didSetProps:changedProps];
|
|
329
|
+
|
|
330
|
+
if (_tabItemNeedsAppearanceUpdate) {
|
|
331
|
+
[_controller tabItemAppearanceHasChanged];
|
|
332
|
+
_tabItemNeedsAppearanceUpdate = NO;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
#pragma mark - LEGACY prop setters
|
|
337
|
+
|
|
338
|
+
- (void)setIsSelectedScreen:(BOOL)isSelectedScreen
|
|
339
|
+
{
|
|
340
|
+
if (_isSelectedScreen != isSelectedScreen) {
|
|
341
|
+
_isSelectedScreen = isSelectedScreen;
|
|
342
|
+
[_controller tabScreenFocusHasChanged];
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
- (void)setTabKey:(NSString *)tabKey
|
|
347
|
+
{
|
|
348
|
+
RCTAssert([NSString rnscreens_isBlankOrNull:tabKey] == NO, @"[RNScreens] tabKey must not be empty");
|
|
349
|
+
_tabKey = tabKey;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
- (void)setTitle:(NSString *)title
|
|
353
|
+
{
|
|
354
|
+
_title = title;
|
|
355
|
+
_controller.title = title;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
- (void)setBadgeValue:(NSString *)badgeValue
|
|
359
|
+
{
|
|
360
|
+
_badgeValue = [NSString rnscreens_stringOrNilIfBlank:badgeValue];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
- (void)setTabBarBackgroundColor:(UIColor *)tabBarBackgroundColor
|
|
364
|
+
{
|
|
365
|
+
_tabBarBackgroundColor = tabBarBackgroundColor;
|
|
366
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
- (void)setTabBarBlurEffect:(UIBlurEffect *)tabBarBlurEffect
|
|
370
|
+
{
|
|
371
|
+
_tabBarBlurEffect = tabBarBlurEffect;
|
|
372
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
- (void)setTabBarItemTitleFontFamily:(NSString *)tabBarItemTitleFontFamily
|
|
376
|
+
{
|
|
377
|
+
_tabBarItemTitleFontFamily = [NSString rnscreens_stringOrNilIfEmpty:tabBarItemTitleFontFamily];
|
|
378
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
- (void)setTabBarItemTitleFontSize:(NSNumber *)tabBarItemTitleFontSize
|
|
382
|
+
{
|
|
383
|
+
_tabBarItemTitleFontSize = tabBarItemTitleFontSize;
|
|
384
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
- (void)setTabBarItemTitleFontWeight:(NSString *)tabBarItemTitleFontWeight
|
|
388
|
+
{
|
|
389
|
+
_tabBarItemTitleFontWeight = [NSString rnscreens_stringOrNilIfEmpty:tabBarItemTitleFontWeight];
|
|
390
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
- (void)setTabBarItemTitleFontStyle:(NSString *)tabBarItemTitleFontStyle
|
|
394
|
+
{
|
|
395
|
+
_tabBarItemTitleFontStyle = [NSString rnscreens_stringOrNilIfEmpty:tabBarItemTitleFontStyle];
|
|
396
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
- (void)setTabBarItemTitleFontColor:(UIColor *)tabBarItemTitleFontColor
|
|
400
|
+
{
|
|
401
|
+
_tabBarItemTitleFontColor = tabBarItemTitleFontColor;
|
|
402
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
- (void)setTabBarItemIconColor:(UIColor *)tabBarItemIconColor
|
|
406
|
+
{
|
|
407
|
+
_tabBarItemIconColor = tabBarItemIconColor;
|
|
408
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
- (void)setTabBarItemTitlePositionAdjustment:(UIOffset)tabBarItemTitlePositionAdjustment
|
|
412
|
+
{
|
|
413
|
+
_tabBarItemTitlePositionAdjustment = tabBarItemTitlePositionAdjustment;
|
|
414
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
- (void)setIconType:(RNSBottomTabsIconType)iconType
|
|
418
|
+
{
|
|
419
|
+
_iconType = iconType;
|
|
420
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
- (void)setIconImageSource:(RCTImageSource *)iconImageSource
|
|
424
|
+
{
|
|
425
|
+
_iconImageSource = iconImageSource;
|
|
426
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
- (void)setIconSfSymbolName:(NSString *)iconSfSymbolName
|
|
430
|
+
{
|
|
431
|
+
_iconSfSymbolName = [NSString rnscreens_stringOrNilIfEmpty:iconSfSymbolName];
|
|
432
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
- (void)setSelectedIconImageSource:(RCTImageSource *)selectedIconImageSource
|
|
436
|
+
{
|
|
437
|
+
_selectedIconImageSource = selectedIconImageSource;
|
|
438
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
- (void)setSelectedIconSfSymbolName:(NSString *)selectedIconSfSymbolName
|
|
442
|
+
{
|
|
443
|
+
_selectedIconSfSymbolName = [NSString rnscreens_stringOrNilIfEmpty:selectedIconSfSymbolName];
|
|
444
|
+
_tabItemNeedsAppearanceUpdate = YES;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
- (void)setOnWillAppear:(RCTDirectEventBlock)onWillAppear
|
|
448
|
+
{
|
|
449
|
+
[self.reactEventEmitter setOnWillAppear:onWillAppear];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
- (void)setOnWillDisappear:(RCTDirectEventBlock)onWillDisappear
|
|
453
|
+
{
|
|
454
|
+
[self.reactEventEmitter setOnWillDisappear:onWillDisappear];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
- (void)setOnDidAppear:(RCTDirectEventBlock)onDidAppear
|
|
458
|
+
{
|
|
459
|
+
[self.reactEventEmitter setOnDidAppear:onDidAppear];
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
- (void)setOnDidDisappear:(RCTDirectEventBlock)onDidDisappear
|
|
463
|
+
{
|
|
464
|
+
[self.reactEventEmitter setOnDidDisappear:onDidDisappear];
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
#define RNS_FAILING_EVENT_GETTER(eventName) \
|
|
468
|
+
-(RCTDirectEventBlock)eventName \
|
|
469
|
+
{ \
|
|
470
|
+
RCTAssert(NO, @"[RNScreens] Events should be emitted through reactEventEmitter"); \
|
|
471
|
+
return nil; \
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
RNS_FAILING_EVENT_GETTER(onWillAppear);
|
|
475
|
+
RNS_FAILING_EVENT_GETTER(onDidAppear);
|
|
476
|
+
RNS_FAILING_EVENT_GETTER(onWillDisappear);
|
|
477
|
+
RNS_FAILING_EVENT_GETTER(onDidDisappear);
|
|
478
|
+
|
|
479
|
+
#undef RNS_FAILING_EVENT_GETTER
|
|
480
|
+
|
|
481
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
482
|
+
|
|
483
|
+
@end
|
|
484
|
+
|
|
485
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
486
|
+
#pragma mark - View class exposure
|
|
487
|
+
|
|
488
|
+
Class<RCTComponentViewProtocol> RNSBottomTabsScreen(void)
|
|
489
|
+
{
|
|
490
|
+
return RNSBottomTabsScreenComponentView.class;
|
|
491
|
+
}
|
|
492
|
+
#endif // RCT_NEW_ARCH_ENABLED
|