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,216 @@
|
|
|
1
|
+
#import <React/RCTConversions.h>
|
|
2
|
+
#import <react/renderer/imagemanager/RCTImagePrimitivesConversions.h>
|
|
3
|
+
#import "RNSConversions.h"
|
|
4
|
+
|
|
5
|
+
namespace rnscreens::conversion {
|
|
6
|
+
|
|
7
|
+
std::optional<UIBlurEffectStyle> RNSMaybeUIBlurEffectStyleFromRNSBottomTabsTabBarBlurEffect(
|
|
8
|
+
react::RNSBottomTabsTabBarBlurEffect blurEffect)
|
|
9
|
+
{
|
|
10
|
+
using enum facebook::react::RNSBottomTabsTabBarBlurEffect;
|
|
11
|
+
#if !TARGET_OS_TV
|
|
12
|
+
switch (blurEffect) {
|
|
13
|
+
case None:
|
|
14
|
+
return std::nullopt;
|
|
15
|
+
case ExtraLight:
|
|
16
|
+
return {UIBlurEffectStyleExtraLight};
|
|
17
|
+
case Light:
|
|
18
|
+
return {UIBlurEffectStyleLight};
|
|
19
|
+
case Dark:
|
|
20
|
+
return {UIBlurEffectStyleDark};
|
|
21
|
+
case Regular:
|
|
22
|
+
return {UIBlurEffectStyleRegular};
|
|
23
|
+
case Prominent:
|
|
24
|
+
return {UIBlurEffectStyleProminent};
|
|
25
|
+
case SystemUltraThinMaterial:
|
|
26
|
+
return {UIBlurEffectStyleSystemUltraThinMaterial};
|
|
27
|
+
case SystemThinMaterial:
|
|
28
|
+
return {UIBlurEffectStyleSystemThinMaterial};
|
|
29
|
+
case SystemMaterial:
|
|
30
|
+
return {UIBlurEffectStyleSystemMaterial};
|
|
31
|
+
case SystemThickMaterial:
|
|
32
|
+
return {UIBlurEffectStyleSystemThickMaterial};
|
|
33
|
+
case SystemChromeMaterial:
|
|
34
|
+
return {UIBlurEffectStyleSystemChromeMaterial};
|
|
35
|
+
case SystemUltraThinMaterialLight:
|
|
36
|
+
return {UIBlurEffectStyleSystemUltraThinMaterialLight};
|
|
37
|
+
case SystemThinMaterialLight:
|
|
38
|
+
return {UIBlurEffectStyleSystemThinMaterialLight};
|
|
39
|
+
case SystemMaterialLight:
|
|
40
|
+
return {UIBlurEffectStyleSystemMaterialLight};
|
|
41
|
+
case SystemThickMaterialLight:
|
|
42
|
+
return {UIBlurEffectStyleSystemThickMaterialLight};
|
|
43
|
+
case SystemChromeMaterialLight:
|
|
44
|
+
return {UIBlurEffectStyleSystemChromeMaterialLight};
|
|
45
|
+
case SystemUltraThinMaterialDark:
|
|
46
|
+
return {UIBlurEffectStyleSystemUltraThinMaterialDark};
|
|
47
|
+
case SystemThinMaterialDark:
|
|
48
|
+
return {UIBlurEffectStyleSystemThinMaterialDark};
|
|
49
|
+
case SystemMaterialDark:
|
|
50
|
+
return {UIBlurEffectStyleSystemMaterialDark};
|
|
51
|
+
case SystemThickMaterialDark:
|
|
52
|
+
return {UIBlurEffectStyleSystemThickMaterialDark};
|
|
53
|
+
case SystemChromeMaterialDark:
|
|
54
|
+
return {UIBlurEffectStyleSystemChromeMaterialDark};
|
|
55
|
+
}
|
|
56
|
+
#endif
|
|
57
|
+
|
|
58
|
+
switch (blurEffect) {
|
|
59
|
+
case None:
|
|
60
|
+
return std::nullopt;
|
|
61
|
+
case Light:
|
|
62
|
+
return {UIBlurEffectStyleLight};
|
|
63
|
+
case Dark:
|
|
64
|
+
return {UIBlurEffectStyleDark};
|
|
65
|
+
case Regular:
|
|
66
|
+
return {UIBlurEffectStyleRegular};
|
|
67
|
+
case Prominent:
|
|
68
|
+
return {UIBlurEffectStyleProminent};
|
|
69
|
+
case ExtraLight:
|
|
70
|
+
return {UIBlurEffectStyleExtraLight};
|
|
71
|
+
default:
|
|
72
|
+
return std::nullopt;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
UIBlurEffect *RNSUIBlurEffectFromRNSBottomTabsTabBarBlurEffect(react::RNSBottomTabsTabBarBlurEffect blurEffect)
|
|
77
|
+
{
|
|
78
|
+
std::optional<UIBlurEffectStyle> maybeStyle = RNSMaybeUIBlurEffectStyleFromRNSBottomTabsTabBarBlurEffect(blurEffect);
|
|
79
|
+
if (maybeStyle) {
|
|
80
|
+
return [UIBlurEffect effectWithStyle:maybeStyle.value()];
|
|
81
|
+
}
|
|
82
|
+
return nil;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
UIOffset RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct(
|
|
86
|
+
react::RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct titlePositionAdjustment)
|
|
87
|
+
{
|
|
88
|
+
return UIOffsetMake(titlePositionAdjustment.horizontal, titlePositionAdjustment.vertical);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
std::optional<UIBlurEffectStyle> RNSMaybeUIBlurEffectStyleFromRNSBottomTabsScreenTabBarBlurEffect(
|
|
92
|
+
react::RNSBottomTabsScreenTabBarBlurEffect blurEffect)
|
|
93
|
+
{
|
|
94
|
+
using enum facebook::react::RNSBottomTabsScreenTabBarBlurEffect;
|
|
95
|
+
#if !TARGET_OS_TV
|
|
96
|
+
switch (blurEffect) {
|
|
97
|
+
case None:
|
|
98
|
+
return std::nullopt;
|
|
99
|
+
case ExtraLight:
|
|
100
|
+
return {UIBlurEffectStyleExtraLight};
|
|
101
|
+
case Light:
|
|
102
|
+
return {UIBlurEffectStyleLight};
|
|
103
|
+
case Dark:
|
|
104
|
+
return {UIBlurEffectStyleDark};
|
|
105
|
+
case Regular:
|
|
106
|
+
return {UIBlurEffectStyleRegular};
|
|
107
|
+
case Prominent:
|
|
108
|
+
return {UIBlurEffectStyleProminent};
|
|
109
|
+
case SystemUltraThinMaterial:
|
|
110
|
+
return {UIBlurEffectStyleSystemUltraThinMaterial};
|
|
111
|
+
case SystemThinMaterial:
|
|
112
|
+
return {UIBlurEffectStyleSystemThinMaterial};
|
|
113
|
+
case SystemMaterial:
|
|
114
|
+
return {UIBlurEffectStyleSystemMaterial};
|
|
115
|
+
case SystemThickMaterial:
|
|
116
|
+
return {UIBlurEffectStyleSystemThickMaterial};
|
|
117
|
+
case SystemChromeMaterial:
|
|
118
|
+
return {UIBlurEffectStyleSystemChromeMaterial};
|
|
119
|
+
case SystemUltraThinMaterialLight:
|
|
120
|
+
return {UIBlurEffectStyleSystemUltraThinMaterialLight};
|
|
121
|
+
case SystemThinMaterialLight:
|
|
122
|
+
return {UIBlurEffectStyleSystemThinMaterialLight};
|
|
123
|
+
case SystemMaterialLight:
|
|
124
|
+
return {UIBlurEffectStyleSystemMaterialLight};
|
|
125
|
+
case SystemThickMaterialLight:
|
|
126
|
+
return {UIBlurEffectStyleSystemThickMaterialLight};
|
|
127
|
+
case SystemChromeMaterialLight:
|
|
128
|
+
return {UIBlurEffectStyleSystemChromeMaterialLight};
|
|
129
|
+
case SystemUltraThinMaterialDark:
|
|
130
|
+
return {UIBlurEffectStyleSystemUltraThinMaterialDark};
|
|
131
|
+
case SystemThinMaterialDark:
|
|
132
|
+
return {UIBlurEffectStyleSystemThinMaterialDark};
|
|
133
|
+
case SystemMaterialDark:
|
|
134
|
+
return {UIBlurEffectStyleSystemMaterialDark};
|
|
135
|
+
case SystemThickMaterialDark:
|
|
136
|
+
return {UIBlurEffectStyleSystemThickMaterialDark};
|
|
137
|
+
case SystemChromeMaterialDark:
|
|
138
|
+
return {UIBlurEffectStyleSystemChromeMaterialDark};
|
|
139
|
+
}
|
|
140
|
+
#endif
|
|
141
|
+
|
|
142
|
+
switch (blurEffect) {
|
|
143
|
+
case None:
|
|
144
|
+
return std::nullopt;
|
|
145
|
+
case Light:
|
|
146
|
+
return {UIBlurEffectStyleLight};
|
|
147
|
+
case Dark:
|
|
148
|
+
return {UIBlurEffectStyleDark};
|
|
149
|
+
case Regular:
|
|
150
|
+
return {UIBlurEffectStyleRegular};
|
|
151
|
+
case Prominent:
|
|
152
|
+
return {UIBlurEffectStyleProminent};
|
|
153
|
+
case ExtraLight:
|
|
154
|
+
return {UIBlurEffectStyleExtraLight};
|
|
155
|
+
default:
|
|
156
|
+
return std::nullopt;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
UIBlurEffect *RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(
|
|
161
|
+
react::RNSBottomTabsScreenTabBarBlurEffect blurEffect)
|
|
162
|
+
{
|
|
163
|
+
std::optional<UIBlurEffectStyle> maybeStyle =
|
|
164
|
+
RNSMaybeUIBlurEffectStyleFromRNSBottomTabsScreenTabBarBlurEffect(blurEffect);
|
|
165
|
+
if (maybeStyle) {
|
|
166
|
+
return [UIBlurEffect effectWithStyle:maybeStyle.value()];
|
|
167
|
+
}
|
|
168
|
+
return nil;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
UIOffset RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct(
|
|
172
|
+
react::RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct titlePositionAdjustment)
|
|
173
|
+
{
|
|
174
|
+
return UIOffsetMake(titlePositionAdjustment.horizontal, titlePositionAdjustment.vertical);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
RNSBottomTabsIconType RNSBottomTabsIconTypeFromIcon(react::RNSBottomTabsScreenIconType iconType)
|
|
178
|
+
{
|
|
179
|
+
using enum facebook::react::RNSBottomTabsScreenIconType;
|
|
180
|
+
switch (iconType) {
|
|
181
|
+
case Image:
|
|
182
|
+
return RNSBottomTabsIconTypeImage;
|
|
183
|
+
case Template:
|
|
184
|
+
return RNSBottomTabsIconTypeTemplate;
|
|
185
|
+
case SfSymbol:
|
|
186
|
+
return RNSBottomTabsIconTypeSfSymbol;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
RCTImageSource *RCTImageSourceFromImageSourceAndIconType(
|
|
191
|
+
const facebook::react::ImageSource *imageSource,
|
|
192
|
+
RNSBottomTabsIconType iconType)
|
|
193
|
+
{
|
|
194
|
+
RCTImageSource *iconImageSource;
|
|
195
|
+
|
|
196
|
+
switch (iconType) {
|
|
197
|
+
case RNSBottomTabsIconTypeSfSymbol:
|
|
198
|
+
iconImageSource = nil;
|
|
199
|
+
break;
|
|
200
|
+
|
|
201
|
+
case RNSBottomTabsIconTypeImage:
|
|
202
|
+
case RNSBottomTabsIconTypeTemplate:
|
|
203
|
+
iconImageSource =
|
|
204
|
+
[[RCTImageSource alloc] initWithURLRequest:NSURLRequestFromImageSource(*imageSource)
|
|
205
|
+
size:CGSizeMake(imageSource->size.width, imageSource->size.height)
|
|
206
|
+
scale:imageSource->scale];
|
|
207
|
+
break;
|
|
208
|
+
|
|
209
|
+
default:
|
|
210
|
+
RCTLogError(@"[RNScreens] unsupported icon type");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return iconImageSource;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
}; // namespace rnscreens::conversion
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#import "RNSConversions.h"
|
|
2
|
+
|
|
3
|
+
namespace rnscreens::conversion {
|
|
4
|
+
|
|
5
|
+
#pragma mark RN Codegen enum to internal enum conversions
|
|
6
|
+
|
|
7
|
+
UISplitViewControllerSplitBehavior SplitViewSplitBehaviorFromHostProp(
|
|
8
|
+
facebook::react::RNSSplitViewHostSplitBehavior splitBehavior)
|
|
9
|
+
{
|
|
10
|
+
using enum facebook::react::RNSSplitViewHostSplitBehavior;
|
|
11
|
+
|
|
12
|
+
switch (splitBehavior) {
|
|
13
|
+
case Displace:
|
|
14
|
+
return UISplitViewControllerSplitBehaviorDisplace;
|
|
15
|
+
case Overlay:
|
|
16
|
+
return UISplitViewControllerSplitBehaviorOverlay;
|
|
17
|
+
case Tile:
|
|
18
|
+
return UISplitViewControllerSplitBehaviorTile;
|
|
19
|
+
case Automatic:
|
|
20
|
+
default:
|
|
21
|
+
return UISplitViewControllerSplitBehaviorAutomatic;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
UISplitViewControllerPrimaryEdge SplitViewPrimaryEdgeFromHostProp(
|
|
26
|
+
facebook::react::RNSSplitViewHostPrimaryEdge primaryEdge)
|
|
27
|
+
{
|
|
28
|
+
using enum facebook::react::RNSSplitViewHostPrimaryEdge;
|
|
29
|
+
|
|
30
|
+
switch (primaryEdge) {
|
|
31
|
+
case Trailing:
|
|
32
|
+
return UISplitViewControllerPrimaryEdgeTrailing;
|
|
33
|
+
case Leading:
|
|
34
|
+
default:
|
|
35
|
+
return UISplitViewControllerPrimaryEdgeLeading;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
UISplitViewControllerDisplayMode SplitViewDisplayModeFromHostProp(
|
|
40
|
+
facebook::react::RNSSplitViewHostDisplayMode displayMode)
|
|
41
|
+
{
|
|
42
|
+
using enum facebook::react::RNSSplitViewHostDisplayMode;
|
|
43
|
+
|
|
44
|
+
switch (displayMode) {
|
|
45
|
+
case SecondaryOnly:
|
|
46
|
+
return UISplitViewControllerDisplayModeSecondaryOnly;
|
|
47
|
+
case OneBesideSecondary:
|
|
48
|
+
return UISplitViewControllerDisplayModeOneBesideSecondary;
|
|
49
|
+
case OneOverSecondary:
|
|
50
|
+
return UISplitViewControllerDisplayModeOneOverSecondary;
|
|
51
|
+
case TwoBesideSecondary:
|
|
52
|
+
return UISplitViewControllerDisplayModeTwoBesideSecondary;
|
|
53
|
+
case TwoOverSecondary:
|
|
54
|
+
return UISplitViewControllerDisplayModeTwoOverSecondary;
|
|
55
|
+
case TwoDisplaceSecondary:
|
|
56
|
+
return UISplitViewControllerDisplayModeTwoDisplaceSecondary;
|
|
57
|
+
case Automatic:
|
|
58
|
+
default:
|
|
59
|
+
return UISplitViewControllerDisplayModeAutomatic;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}; // namespace rnscreens::conversion
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(__cplusplus)
|
|
4
|
+
#import <react/renderer/components/rnscreens/Props.h>
|
|
5
|
+
#import <React/RCTImageSource.h>
|
|
6
|
+
#import "RNSEnums.h"
|
|
7
|
+
|
|
8
|
+
namespace rnscreens::conversion {
|
|
9
|
+
|
|
10
|
+
namespace react = facebook::react;
|
|
11
|
+
|
|
12
|
+
std::optional<UIBlurEffectStyle>
|
|
13
|
+
RNSMaybeUIBlurEffectStyleFromRNSBottomTabsTabBarBlurEffect(
|
|
14
|
+
react::RNSBottomTabsTabBarBlurEffect blurEffect);
|
|
15
|
+
|
|
16
|
+
UIBlurEffect *RNSUIBlurEffectFromRNSBottomTabsTabBarBlurEffect(
|
|
17
|
+
react::RNSBottomTabsTabBarBlurEffect blurEffect);
|
|
18
|
+
|
|
19
|
+
UIOffset RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct(
|
|
20
|
+
react::RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct
|
|
21
|
+
titlePositionAdjustment);
|
|
22
|
+
|
|
23
|
+
std::optional<UIBlurEffectStyle>
|
|
24
|
+
RNSMaybeUIBlurEffectStyleFromRNSBottomTabsScreenTabBarBlurEffect(
|
|
25
|
+
react::RNSBottomTabsScreenTabBarBlurEffect blurEffect);
|
|
26
|
+
|
|
27
|
+
UIBlurEffect *RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(
|
|
28
|
+
react::RNSBottomTabsScreenTabBarBlurEffect blurEffect);
|
|
29
|
+
|
|
30
|
+
UIOffset RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct(
|
|
31
|
+
react::RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct
|
|
32
|
+
titlePositionAdjustment);
|
|
33
|
+
|
|
34
|
+
RNSBottomTabsIconType RNSBottomTabsIconTypeFromIcon(react::RNSBottomTabsScreenIconType iconType);
|
|
35
|
+
|
|
36
|
+
RCTImageSource *RCTImageSourceFromImageSourceAndIconType(
|
|
37
|
+
const facebook::react::ImageSource *imageSource,
|
|
38
|
+
RNSBottomTabsIconType iconType);
|
|
39
|
+
|
|
40
|
+
#pragma mark SplitView
|
|
41
|
+
|
|
42
|
+
UISplitViewControllerSplitBehavior SplitViewSplitBehaviorFromHostProp(
|
|
43
|
+
react::RNSSplitViewHostSplitBehavior behavior);
|
|
44
|
+
|
|
45
|
+
UISplitViewControllerPrimaryEdge SplitViewPrimaryEdgeFromHostProp(
|
|
46
|
+
react::RNSSplitViewHostPrimaryEdge primaryEdge);
|
|
47
|
+
|
|
48
|
+
UISplitViewControllerDisplayMode SplitViewDisplayModeFromHostProp(
|
|
49
|
+
react::RNSSplitViewHostDisplayMode displayMode);
|
|
50
|
+
|
|
51
|
+
}; // namespace rnscreens::conversion
|
|
52
|
+
|
|
53
|
+
#endif
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#import "RNSEnums.h"
|
|
2
|
+
#import "RNSReactBaseView.h"
|
|
3
|
+
|
|
4
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
+
|
|
6
|
+
@class RNSSplitViewHostController;
|
|
7
|
+
@class RNSSplitViewScreenComponentView;
|
|
8
|
+
|
|
9
|
+
@interface RNSSplitViewHostComponentView : RNSReactBaseView
|
|
10
|
+
|
|
11
|
+
- (nonnull NSMutableArray<RNSSplitViewScreenComponentView *> *)reactSubviews;
|
|
12
|
+
|
|
13
|
+
@property (nonatomic, nonnull, strong, readonly) RNSSplitViewHostController *splitViewHostController;
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
#pragma mark - Props
|
|
18
|
+
|
|
19
|
+
@interface RNSSplitViewHostComponentView ()
|
|
20
|
+
|
|
21
|
+
@property (nonatomic, readonly) UISplitViewControllerSplitBehavior splitBehavior;
|
|
22
|
+
@property (nonatomic, readonly) UISplitViewControllerPrimaryEdge primaryEdge;
|
|
23
|
+
@property (nonatomic, readonly) UISplitViewControllerDisplayMode displayMode;
|
|
24
|
+
@property (nonatomic, readonly) BOOL presentsWithGesture;
|
|
25
|
+
@property (nonatomic, readonly) BOOL showSecondaryToggleButton;
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
|
|
29
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#import "RNSSplitViewHostComponentView.h"
|
|
2
|
+
#import <React/RCTAssert.h>
|
|
3
|
+
#import <React/RCTMountingTransactionObserving.h>
|
|
4
|
+
#import <React/UIView+React.h>
|
|
5
|
+
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
6
|
+
|
|
7
|
+
#import "RNSConversions.h"
|
|
8
|
+
#import "RNSDefines.h"
|
|
9
|
+
#import "RNSSplitViewScreenComponentView.h"
|
|
10
|
+
#import "Swift-Bridging.h"
|
|
11
|
+
|
|
12
|
+
namespace react = facebook::react;
|
|
13
|
+
|
|
14
|
+
@interface RNSSplitViewHostComponentView () <RCTMountingTransactionObserving>
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@implementation RNSSplitViewHostComponentView {
|
|
18
|
+
RNSSplitViewHostController *_Nonnull _controller;
|
|
19
|
+
NSMutableArray<RNSSplitViewScreenComponentView *> *_Nonnull _reactSubviews;
|
|
20
|
+
|
|
21
|
+
bool _hasModifiedReactSubviewsInCurrentTransaction;
|
|
22
|
+
// We need this information to warn users about dynamic changes to behavior being currently unsupported.
|
|
23
|
+
bool _isShowSecondaryToggleButtonSet;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
27
|
+
{
|
|
28
|
+
if (self = [super initWithFrame:frame]) {
|
|
29
|
+
[self initState];
|
|
30
|
+
}
|
|
31
|
+
return self;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (void)initState
|
|
35
|
+
{
|
|
36
|
+
[self resetProps];
|
|
37
|
+
// TODO: For now I'm hardcoding style in init, but style cannot be updated outside controller's constructor, thus
|
|
38
|
+
// we'll need to delay the initialization unitl Screen components will be mounted
|
|
39
|
+
_controller =
|
|
40
|
+
[[RNSSplitViewHostController alloc] initWithSplitViewHostComponentView:self
|
|
41
|
+
style:UISplitViewControllerStyleTripleColumn];
|
|
42
|
+
_hasModifiedReactSubviewsInCurrentTransaction = false;
|
|
43
|
+
_reactSubviews = [NSMutableArray new];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)resetProps
|
|
47
|
+
{
|
|
48
|
+
static const auto defaultProps = std::make_shared<const react::RNSSplitViewHostProps>();
|
|
49
|
+
_props = defaultProps;
|
|
50
|
+
|
|
51
|
+
_splitBehavior = UISplitViewControllerSplitBehaviorAutomatic;
|
|
52
|
+
_primaryEdge = UISplitViewControllerPrimaryEdgeLeading;
|
|
53
|
+
_displayMode = UISplitViewControllerDisplayModeAutomatic;
|
|
54
|
+
_presentsWithGesture = true;
|
|
55
|
+
_showSecondaryToggleButton = false;
|
|
56
|
+
|
|
57
|
+
_isShowSecondaryToggleButtonSet = false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (void)didMoveToWindow
|
|
61
|
+
{
|
|
62
|
+
RCTAssert(_controller != nil, @"[RNScreens] Controller must not be nil while attaching to window");
|
|
63
|
+
|
|
64
|
+
[self reactAddControllerToClosestParent:_controller];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
- (void)reactAddControllerToClosestParent:(UIViewController *)controller
|
|
68
|
+
{
|
|
69
|
+
if (!controller.parentViewController) {
|
|
70
|
+
UIView *parentView = (UIView *)self.reactSuperview;
|
|
71
|
+
while (parentView) {
|
|
72
|
+
if (parentView.reactViewController) {
|
|
73
|
+
[parentView.reactViewController addChildViewController:controller];
|
|
74
|
+
[self addSubview:controller.view];
|
|
75
|
+
[controller didMoveToParentViewController:parentView.reactViewController];
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
parentView = (UIView *)parentView.reactSuperview;
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
RNS_IGNORE_SUPER_CALL_BEGIN
|
|
85
|
+
- (nonnull NSMutableArray<RNSSplitViewScreenComponentView *> *)reactSubviews
|
|
86
|
+
{
|
|
87
|
+
RCTAssert(
|
|
88
|
+
_reactSubviews != nil,
|
|
89
|
+
@"[RNScreens] Attempt to work with non-initialized list of RNSSplitViewScreenComponentView subviews. (for: %@)",
|
|
90
|
+
self);
|
|
91
|
+
return _reactSubviews;
|
|
92
|
+
}
|
|
93
|
+
RNS_IGNORE_SUPER_CALL_END
|
|
94
|
+
|
|
95
|
+
- (nonnull RNSSplitViewHostController *)splitViewHostController
|
|
96
|
+
{
|
|
97
|
+
RCTAssert(_controller != nil, @"[RNScreens] Controller must not be nil");
|
|
98
|
+
return _controller;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
#pragma mark - RCTViewComponentViewProtocol
|
|
102
|
+
|
|
103
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
104
|
+
{
|
|
105
|
+
RCTAssert(
|
|
106
|
+
[childComponentView isKindOfClass:RNSSplitViewScreenComponentView.class],
|
|
107
|
+
@"[RNScreens] Attempt to mount child of unsupported type: %@, expected %@",
|
|
108
|
+
childComponentView.class,
|
|
109
|
+
RNSSplitViewScreenComponentView.class);
|
|
110
|
+
|
|
111
|
+
auto *childScreen = static_cast<RNSSplitViewScreenComponentView *>(childComponentView);
|
|
112
|
+
childScreen.splitViewHost = self;
|
|
113
|
+
[_reactSubviews insertObject:childScreen atIndex:index];
|
|
114
|
+
_hasModifiedReactSubviewsInCurrentTransaction = true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
118
|
+
{
|
|
119
|
+
RCTAssert(
|
|
120
|
+
[childComponentView isKindOfClass:RNSSplitViewScreenComponentView.class],
|
|
121
|
+
@"[RNScreens] Attempt to unmount child of unsupported type: %@, expected %@",
|
|
122
|
+
childComponentView.class,
|
|
123
|
+
RNSSplitViewScreenComponentView.class);
|
|
124
|
+
|
|
125
|
+
auto *childScreen = static_cast<RNSSplitViewScreenComponentView *>(childComponentView);
|
|
126
|
+
childScreen.splitViewHost = nil;
|
|
127
|
+
[_reactSubviews removeObject:childScreen];
|
|
128
|
+
_hasModifiedReactSubviewsInCurrentTransaction = true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
132
|
+
{
|
|
133
|
+
return react::concreteComponentDescriptorProvider<react::RNSSplitViewHostComponentDescriptor>();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
+ (BOOL)shouldBeRecycled
|
|
137
|
+
{
|
|
138
|
+
// There won't be tens of instances of this component usually & it's easier for now.
|
|
139
|
+
// We could consider enabling it someday though.
|
|
140
|
+
return NO;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
144
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
145
|
+
{
|
|
146
|
+
const auto &oldComponentProps = *std::static_pointer_cast<const react::RNSSplitViewHostProps>(_props);
|
|
147
|
+
const auto &newComponentProps = *std::static_pointer_cast<const react::RNSSplitViewHostProps>(props);
|
|
148
|
+
|
|
149
|
+
if (oldComponentProps.splitBehavior != newComponentProps.splitBehavior) {
|
|
150
|
+
_splitBehavior = rnscreens::conversion::SplitViewSplitBehaviorFromHostProp(newComponentProps.splitBehavior);
|
|
151
|
+
_controller.preferredSplitBehavior = _splitBehavior;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (oldComponentProps.primaryEdge != newComponentProps.primaryEdge) {
|
|
155
|
+
_primaryEdge = rnscreens::conversion::SplitViewPrimaryEdgeFromHostProp(newComponentProps.primaryEdge);
|
|
156
|
+
_controller.primaryEdge = _primaryEdge;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (oldComponentProps.displayMode != newComponentProps.displayMode) {
|
|
160
|
+
_displayMode = rnscreens::conversion::SplitViewDisplayModeFromHostProp(newComponentProps.displayMode);
|
|
161
|
+
_controller.preferredDisplayMode = _displayMode;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (oldComponentProps.presentsWithGesture != newComponentProps.presentsWithGesture) {
|
|
165
|
+
_presentsWithGesture = newComponentProps.presentsWithGesture;
|
|
166
|
+
_controller.presentsWithGesture = _presentsWithGesture;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (oldComponentProps.showSecondaryToggleButton != newComponentProps.showSecondaryToggleButton) {
|
|
170
|
+
_showSecondaryToggleButton = newComponentProps.showSecondaryToggleButton;
|
|
171
|
+
_controller.showsSecondaryOnlyButton = _showSecondaryToggleButton;
|
|
172
|
+
|
|
173
|
+
if (_isShowSecondaryToggleButtonSet) {
|
|
174
|
+
RCTLogWarn(@"[RNScreens] changing showSecondaryToggleButton dynamically is currently unsupported");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// This flag is set to true when showsSecondaryOnlyButton prop is assigned for the first time.
|
|
179
|
+
// This allows us to identify any subsequent changes to this prop,
|
|
180
|
+
// enabling us to warn users that dynamic changes are not supported.
|
|
181
|
+
_isShowSecondaryToggleButtonSet = true;
|
|
182
|
+
|
|
183
|
+
[super updateProps:props oldProps:oldProps];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#pragma mark - RCTMountingTransactionObserving
|
|
187
|
+
|
|
188
|
+
- (void)mountingTransactionWillMount:(const facebook::react::MountingTransaction &)transaction
|
|
189
|
+
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
|
|
190
|
+
{
|
|
191
|
+
_hasModifiedReactSubviewsInCurrentTransaction = false;
|
|
192
|
+
[_controller reactMountingTransactionWillMount];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
- (void)mountingTransactionDidMount:(const facebook::react::MountingTransaction &)transaction
|
|
196
|
+
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
|
|
197
|
+
{
|
|
198
|
+
if (_hasModifiedReactSubviewsInCurrentTransaction) {
|
|
199
|
+
[_controller setNeedsUpdateOfChildViewControllers];
|
|
200
|
+
}
|
|
201
|
+
[_controller reactMountingTransactionDidMount];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@end
|
|
205
|
+
|
|
206
|
+
Class<RCTComponentViewProtocol> RNSSplitViewHostCls(void)
|
|
207
|
+
{
|
|
208
|
+
return RNSSplitViewHostComponentView.class;
|
|
209
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
@objc
|
|
5
|
+
public class RNSSplitViewHostController: UISplitViewController, ReactMountingTransactionObserving {
|
|
6
|
+
private var needsChildViewControllersUpdate = false
|
|
7
|
+
private let splitViewHostComponentView: RNSSplitViewHostComponentView
|
|
8
|
+
|
|
9
|
+
@objc public init(
|
|
10
|
+
splitViewHostComponentView: RNSSplitViewHostComponentView, style: UISplitViewController.Style
|
|
11
|
+
) {
|
|
12
|
+
self.splitViewHostComponentView = splitViewHostComponentView
|
|
13
|
+
super.init(style: style)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
required init?(coder aDecoder: NSCoder) {
|
|
17
|
+
return nil
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// MARK: Signals
|
|
21
|
+
|
|
22
|
+
@objc
|
|
23
|
+
public func setNeedsUpdateOfChildViewControllers() {
|
|
24
|
+
needsChildViewControllersUpdate = true
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: Updating
|
|
28
|
+
|
|
29
|
+
@objc
|
|
30
|
+
public func updateChildViewControllersIfNeeded() {
|
|
31
|
+
if needsChildViewControllersUpdate {
|
|
32
|
+
updateChildViewControllers()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc
|
|
37
|
+
public func updateChildViewControllers() {
|
|
38
|
+
precondition(
|
|
39
|
+
needsChildViewControllersUpdate,
|
|
40
|
+
"[RNScreens] Child view controller must be invalidated when update is forced!")
|
|
41
|
+
|
|
42
|
+
let currentSubviews =
|
|
43
|
+
splitViewHostComponentView.reactSubviews() as! [RNSSplitViewScreenComponentView]
|
|
44
|
+
let currentViewControllers = currentSubviews.map {
|
|
45
|
+
RNSSplitViewNavigationController(rootViewController: $0.controller)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
viewControllers = currentViewControllers
|
|
49
|
+
|
|
50
|
+
for controller in currentViewControllers {
|
|
51
|
+
controller.viewFrameOriginChangeObserver = self
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
needsChildViewControllersUpdate = false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: ReactMountingTransactionObserving
|
|
58
|
+
|
|
59
|
+
@objc
|
|
60
|
+
public func reactMountingTransactionWillMount() {
|
|
61
|
+
// noop
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@objc
|
|
65
|
+
public func reactMountingTransactionDidMount() {
|
|
66
|
+
updateChildViewControllersIfNeeded()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
extension RNSSplitViewHostController {
|
|
71
|
+
var splitViewScreenControllers: [RNSSplitViewScreenController] {
|
|
72
|
+
return viewControllers.lazy.map { viewController in
|
|
73
|
+
assert(
|
|
74
|
+
viewController is RNSSplitViewNavigationController,
|
|
75
|
+
"[RNScreens] Expected RNSSplitViewNavigationController but got \(type(of: viewController))")
|
|
76
|
+
|
|
77
|
+
let splitViewNavigationController = viewController as! RNSSplitViewNavigationController
|
|
78
|
+
let splitViewNavigationControllerTopViewController = splitViewNavigationController
|
|
79
|
+
.topViewController
|
|
80
|
+
assert(
|
|
81
|
+
splitViewNavigationControllerTopViewController is RNSSplitViewScreenController,
|
|
82
|
+
"[RNScreens] Expected RNSSplitViewScreenController but got \(type(of: splitViewNavigationControllerTopViewController))"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return splitViewNavigationControllerTopViewController as! RNSSplitViewScreenController
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
extension RNSSplitViewHostController: RNSSplitViewNavigationControllerViewFrameObserver {
|
|
91
|
+
func splitViewNavCtrlViewDidChangeFrameOrigin(
|
|
92
|
+
_ splitViewNavCtrl: RNSSplitViewNavigationController
|
|
93
|
+
) {
|
|
94
|
+
for controller in self.splitViewScreenControllers {
|
|
95
|
+
controller.columnPositioningDidChangeIn(splitViewController: self)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|