react-native-screens 3.32.0 → 3.33.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/README.md +17 -13
- package/RNScreens.podspec +10 -52
- package/android/CMakeLists.txt +48 -4
- package/android/build.gradle +9 -81
- package/android/src/fabric/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +25 -16
- package/android/src/fabric/java/com/swmansion/rnscreens/NativeProxy.kt +53 -0
- package/android/src/main/cpp/NativeProxy.cpp +51 -0
- package/android/src/main/cpp/NativeProxy.h +35 -0
- package/android/src/main/cpp/OnLoad.cpp +8 -0
- package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +5 -2
- package/android/src/main/java/com/swmansion/rnscreens/CustomToolbar.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/FragmentBackPressOverrider.kt +2 -2
- package/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt +36 -17
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +134 -38
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +52 -30
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainerViewManager.kt +17 -7
- package/android/src/main/java/com/swmansion/rnscreens/ScreenEventDispatcher.kt +10 -2
- package/android/src/main/java/com/swmansion/rnscreens/ScreenFragment.kt +56 -27
- package/android/src/main/java/com/swmansion/rnscreens/ScreenFragmentWrapper.kt +8 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +50 -19
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +60 -37
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragmentWrapper.kt +4 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +85 -58
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +128 -37
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubview.kt +19 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubviewManager.kt +16 -10
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackViewManager.kt +28 -25
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +173 -78
- package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +59 -24
- package/android/src/main/java/com/swmansion/rnscreens/ScreensModule.kt +30 -8
- package/android/src/main/java/com/swmansion/rnscreens/ScreensShadowNode.kt +3 -1
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +101 -50
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +29 -22
- package/android/src/main/java/com/swmansion/rnscreens/SearchViewFormatter.kt +7 -2
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderAttachedEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderBackButtonClickedEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderDetachedEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderHeightChangeEvent.kt +5 -5
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenAppearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenDisappearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenDismissedEvent.kt +8 -4
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenTransitionProgressEvent.kt +7 -6
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenWillAppearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenWillDisappearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarBlurEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarChangeTextEvent.kt +4 -3
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarCloseEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarFocusEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarOpenEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarSearchButtonPressEvent.kt +9 -4
- package/android/src/main/java/com/swmansion/rnscreens/events/StackFinishTransitioningEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/utils/DeviceUtils.kt +1 -5
- package/android/src/main/java/com/swmansion/rnscreens/utils/ScreenDummyLayoutHelper.kt +214 -0
- package/android/src/main/jni/CMakeLists.txt +5 -4
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +3 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +1 -0
- package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +10 -5
- package/android/src/paper/java/com/swmansion/rnscreens/NativeProxy.kt +19 -0
- package/android/src/paper/java/com/swmansion/rnscreens/NativeScreensModuleSpec.java +4 -0
- package/common/cpp/react/renderer/components/rnscreens/FrameCorrectionModes.h +51 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.cpp +2 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h +1 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenComponentDescriptor.h +140 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +51 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h +23 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.cpp +20 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.h +23 -1
- package/common/cpp/react/renderer/components/rnscreens/utils/RectUtil.h +36 -0
- package/cpp/RNSScreenRemovalListener.cpp +25 -0
- package/cpp/RNSScreenRemovalListener.h +20 -0
- package/ios/RNSConvert.h +1 -0
- package/ios/RNSModalScreen.mm +22 -0
- package/ios/RNSModule.mm +1 -1
- package/ios/RNSScreen.h +2 -1
- package/ios/RNSScreen.mm +27 -19
- package/ios/RNSScreenStack.mm +24 -77
- package/ios/RNSScreenStackAnimator.mm +43 -6
- package/ios/RNSScreenStackHeaderConfig.mm +49 -11
- package/ios/RNSScreenStackHeaderSubview.mm +8 -0
- package/ios/utils/UIView+RNSUtility.h +23 -0
- package/ios/utils/UIView+RNSUtility.mm +55 -0
- package/lib/commonjs/components/ScreenStack.js +8 -1
- package/lib/commonjs/components/ScreenStack.js.map +1 -1
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +2 -0
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/components/ScreenStack.js +8 -1
- package/lib/module/components/ScreenStack.js.map +1 -1
- package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +2 -0
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/typescript/components/ScreenStack.d.ts.map +1 -1
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +10 -0
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +10 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/native-stack/README.md +110 -99
- package/package.json +6 -3
- package/react-native.config.js +17 -15
- package/src/TransitionProgressContext.tsx +1 -1
- package/src/components/Screen.tsx +4 -4
- package/src/components/ScreenStack.tsx +11 -1
- package/src/components/ScreenStackHeaderConfig.tsx +5 -5
- package/src/components/ScreenStackHeaderConfig.web.tsx +6 -6
- package/src/components/SearchBar.tsx +4 -4
- package/src/core.ts +1 -1
- package/src/fabric/ModalScreenNativeComponent.ts +1 -0
- package/src/fabric/ScreenNativeComponent.ts +1 -0
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +1 -1
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +1 -1
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +1 -1
- package/src/fabric/SearchBarNativeComponent.ts +1 -1
- package/src/gesture-handler/ScreenGestureDetector.tsx +5 -5
- package/src/gesture-handler/constraints.ts +5 -5
- package/src/gesture-handler/fabricUtils.ts +1 -1
- package/src/native-stack/contexts/GHContext.tsx +1 -1
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +3 -3
- package/src/native-stack/types.tsx +14 -4
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +1 -1
- package/src/native-stack/utils/getStatusBarHeight.tsx +1 -1
- package/src/native-stack/utils/useAnimatedHeaderHeight.tsx +1 -1
- package/src/native-stack/utils/useBackPressSubscription.tsx +1 -1
- package/src/native-stack/utils/useHeaderHeight.tsx +1 -1
- package/src/native-stack/views/FontProcessor.tsx +1 -1
- package/src/native-stack/views/HeaderConfig.tsx +1 -1
- package/src/native-stack/views/NativeStackView.tsx +11 -9
- package/src/reanimated/ReanimatedHeaderHeightContext.tsx +1 -1
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +5 -5
- package/src/reanimated/ReanimatedScreen.tsx +2 -2
- package/src/reanimated/ReanimatedScreenProvider.tsx +1 -1
- package/src/reanimated/useReanimatedHeaderHeight.tsx +1 -1
- package/src/reanimated/useReanimatedTransitionProgress.tsx +1 -1
- package/src/types.tsx +15 -5
- package/src/useTransitionProgress.tsx +1 -1
- package/windows/README.md +4 -1
|
@@ -3,13 +3,63 @@
|
|
|
3
3
|
namespace facebook {
|
|
4
4
|
namespace react {
|
|
5
5
|
|
|
6
|
+
namespace yoga = facebook::yoga;
|
|
7
|
+
using namespace rnscreens;
|
|
8
|
+
|
|
6
9
|
extern const char RNSScreenComponentName[] = "RNSScreen";
|
|
7
10
|
|
|
8
|
-
Point RNSScreenShadowNode::getContentOriginOffset(
|
|
11
|
+
Point RNSScreenShadowNode::getContentOriginOffset(
|
|
12
|
+
bool /*includeTransform*/) const {
|
|
9
13
|
auto stateData = getStateData();
|
|
10
14
|
auto contentOffset = stateData.contentOffset;
|
|
11
15
|
return {contentOffset.x, contentOffset.y};
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
void RNSScreenShadowNode::layout(facebook::react::LayoutContext layoutContext) {
|
|
19
|
+
YogaLayoutableShadowNode::layout(layoutContext);
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
applyFrameCorrections();
|
|
23
|
+
#endif // ANDROID
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#ifdef ANDROID
|
|
27
|
+
void RNSScreenShadowNode::applyFrameCorrections() {
|
|
28
|
+
ensureUnsealed();
|
|
29
|
+
|
|
30
|
+
// On the very first layout we want to correct both Y offset and frame size.
|
|
31
|
+
// On consecutive layouts we want to correct only Y offset, as the frame size
|
|
32
|
+
// is received from JVM side. This is done so if the Screen dimensions are
|
|
33
|
+
// read from ShadowTree (e.g by reanimated) they have chance of being
|
|
34
|
+
// accurate. On JVM side we do ignore this frame anyway, because
|
|
35
|
+
// ScreenStackViewManager.needsCustomLayoutForChildren() == true.
|
|
36
|
+
const auto &stateData = getStateData();
|
|
37
|
+
const float lastKnownHeaderHeight = stateData.getLastKnownHeaderHeight();
|
|
38
|
+
const auto &headerCorrectionModes = stateData.getHeaderCorrectionModes();
|
|
39
|
+
layoutMetrics_.frame.origin.y += lastKnownHeaderHeight *
|
|
40
|
+
headerCorrectionModes.check(
|
|
41
|
+
FrameCorrectionModes::Mode::FrameOriginCorrection);
|
|
42
|
+
layoutMetrics_.frame.size.height -= lastKnownHeaderHeight *
|
|
43
|
+
headerCorrectionModes.check(
|
|
44
|
+
FrameCorrectionModes::Mode::FrameHeightCorrection);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void RNSScreenShadowNode::setHeaderHeight(float headerHeight) {
|
|
48
|
+
getStateDataMutable().setHeaderHeight(headerHeight);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
FrameCorrectionModes &RNSScreenShadowNode::getFrameCorrectionModes() {
|
|
52
|
+
return getStateDataMutable().getFrameCorrectionModes();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
RNSScreenShadowNode::StateData &RNSScreenShadowNode::getStateDataMutable() {
|
|
56
|
+
// We assume that this method is called to mutate the data, so we ensure
|
|
57
|
+
// we're unsealed.
|
|
58
|
+
ensureUnsealed();
|
|
59
|
+
return const_cast<RNSScreenShadowNode::StateData &>(getStateData());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#endif // ANDROID
|
|
63
|
+
|
|
14
64
|
} // namespace react
|
|
15
65
|
} // namespace facebook
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
#include <react/renderer/components/rnscreens/EventEmitters.h>
|
|
5
5
|
#include <react/renderer/components/rnscreens/Props.h>
|
|
6
6
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
7
|
+
#include <react/renderer/core/LayoutContext.h>
|
|
8
|
+
#include "FrameCorrectionModes.h"
|
|
7
9
|
#include "RNSScreenState.h"
|
|
8
10
|
|
|
9
11
|
namespace facebook {
|
|
10
12
|
namespace react {
|
|
11
13
|
|
|
14
|
+
using namespace rnscreens;
|
|
15
|
+
|
|
12
16
|
JSI_EXPORT extern const char RNSScreenComponentName[];
|
|
13
17
|
|
|
14
18
|
class JSI_EXPORT RNSScreenShadowNode final : public ConcreteViewShadowNode<
|
|
@@ -18,8 +22,26 @@ class JSI_EXPORT RNSScreenShadowNode final : public ConcreteViewShadowNode<
|
|
|
18
22
|
RNSScreenState> {
|
|
19
23
|
public:
|
|
20
24
|
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
25
|
+
using StateData = ConcreteViewShadowNode::ConcreteStateData;
|
|
26
|
+
|
|
27
|
+
#pragma mark - ShadowNode overrides
|
|
28
|
+
|
|
29
|
+
Point getContentOriginOffset(bool includeTransform) const override;
|
|
30
|
+
|
|
31
|
+
void layout(LayoutContext layoutContext) override;
|
|
32
|
+
|
|
33
|
+
#pragma mark - Custom interface
|
|
34
|
+
|
|
35
|
+
void setHeaderHeight(float headerHeight);
|
|
36
|
+
|
|
37
|
+
FrameCorrectionModes &getFrameCorrectionModes();
|
|
38
|
+
|
|
39
|
+
private:
|
|
40
|
+
#ifdef ANDROID
|
|
41
|
+
void applyFrameCorrections();
|
|
21
42
|
|
|
22
|
-
|
|
43
|
+
StateData &getStateDataMutable();
|
|
44
|
+
#endif // ANDROID
|
|
23
45
|
};
|
|
24
46
|
|
|
25
47
|
} // namespace react
|
|
@@ -3,12 +3,32 @@
|
|
|
3
3
|
namespace facebook {
|
|
4
4
|
namespace react {
|
|
5
5
|
|
|
6
|
+
using namespace rnscreens;
|
|
7
|
+
|
|
6
8
|
#ifdef ANDROID
|
|
7
9
|
folly::dynamic RNSScreenState::getDynamic() const {
|
|
8
10
|
return folly::dynamic::object("frameWidth", frameSize.width)(
|
|
9
11
|
"frameHeight", frameSize.height)("contentOffsetX", contentOffset.x)(
|
|
10
12
|
"contentOffsetY", contentOffset.y);
|
|
11
13
|
}
|
|
14
|
+
|
|
15
|
+
void RNSScreenState::setHeaderHeight(float headerHeight) {
|
|
16
|
+
lastKnownHeaderHeight_ = headerHeight;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
float RNSScreenState::getLastKnownHeaderHeight() const noexcept {
|
|
20
|
+
return lastKnownHeaderHeight_;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
FrameCorrectionModes &RNSScreenState::getFrameCorrectionModes() noexcept {
|
|
24
|
+
return headerCorrectionModes_;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const FrameCorrectionModes &RNSScreenState::getHeaderCorrectionModes()
|
|
28
|
+
const noexcept {
|
|
29
|
+
return headerCorrectionModes_;
|
|
30
|
+
}
|
|
31
|
+
|
|
12
32
|
#endif
|
|
13
33
|
|
|
14
34
|
} // namespace react
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
10
10
|
#endif
|
|
11
11
|
|
|
12
|
+
#include "FrameCorrectionModes.h"
|
|
13
|
+
|
|
12
14
|
namespace facebook {
|
|
13
15
|
namespace react {
|
|
14
16
|
|
|
17
|
+
using namespace rnscreens;
|
|
18
|
+
|
|
15
19
|
class JSI_EXPORT RNSScreenState final {
|
|
16
20
|
public:
|
|
17
21
|
using Shared = std::shared_ptr<const RNSScreenState>;
|
|
@@ -27,7 +31,9 @@ class JSI_EXPORT RNSScreenState final {
|
|
|
27
31
|
(Float)data["frameHeight"].getDouble()}),
|
|
28
32
|
contentOffset(Point{
|
|
29
33
|
(Float)data["contentOffsetX"].getDouble(),
|
|
30
|
-
(Float)data["contentOffsetY"].getDouble()})
|
|
34
|
+
(Float)data["contentOffsetY"].getDouble()}),
|
|
35
|
+
lastKnownHeaderHeight_{previousState.lastKnownHeaderHeight_},
|
|
36
|
+
headerCorrectionModes_{previousState.headerCorrectionModes_} {};
|
|
31
37
|
#endif
|
|
32
38
|
|
|
33
39
|
const Size frameSize{};
|
|
@@ -39,8 +45,24 @@ class JSI_EXPORT RNSScreenState final {
|
|
|
39
45
|
return MapBufferBuilder::EMPTY();
|
|
40
46
|
};
|
|
41
47
|
|
|
48
|
+
void setHeaderHeight(float headerHeight);
|
|
49
|
+
|
|
50
|
+
float getLastKnownHeaderHeight() const noexcept;
|
|
51
|
+
|
|
52
|
+
FrameCorrectionModes &getFrameCorrectionModes() noexcept;
|
|
53
|
+
|
|
54
|
+
const FrameCorrectionModes &getHeaderCorrectionModes() const noexcept;
|
|
55
|
+
|
|
42
56
|
#endif
|
|
43
57
|
|
|
58
|
+
private:
|
|
59
|
+
#ifdef ANDROID
|
|
60
|
+
// Header height as measured on dummy layout
|
|
61
|
+
float lastKnownHeaderHeight_{0.f};
|
|
62
|
+
|
|
63
|
+
FrameCorrectionModes headerCorrectionModes_{};
|
|
64
|
+
#endif // ANDROID
|
|
65
|
+
|
|
44
66
|
#pragma mark - Getters
|
|
45
67
|
};
|
|
46
68
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/graphics/Float.h>
|
|
4
|
+
#include <react/renderer/graphics/Size.h>
|
|
5
|
+
#include <cmath>
|
|
6
|
+
#include <concepts>
|
|
7
|
+
|
|
8
|
+
namespace rnscreens {
|
|
9
|
+
|
|
10
|
+
namespace react = facebook::react;
|
|
11
|
+
|
|
12
|
+
template <typename T>
|
|
13
|
+
requires std::is_floating_point_v<T>
|
|
14
|
+
inline constexpr bool equalWithRespectToEps(const T a, const T b, const T eps) {
|
|
15
|
+
return std::abs(a - b) <= eps;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Compares given two frame sizes with respect to the epsilon.
|
|
20
|
+
*
|
|
21
|
+
* @param first first frame size
|
|
22
|
+
* @param second second frame size
|
|
23
|
+
* @param eps comparison precision, defaults to 0.01, which should ensure that
|
|
24
|
+
* precision of comparison is under 1px
|
|
25
|
+
* @return whether the frame dimensions are the same with respect to given
|
|
26
|
+
* epsilon
|
|
27
|
+
*/
|
|
28
|
+
inline constexpr bool checkFrameSizesEqualWithEps(
|
|
29
|
+
const react::Size &first,
|
|
30
|
+
const react::Size &second,
|
|
31
|
+
const react::Float eps = 0.01) {
|
|
32
|
+
return equalWithRespectToEps(first.width, second.width, eps) &&
|
|
33
|
+
equalWithRespectToEps(first.height, second.height, eps);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
} // namespace rnscreens
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#include "RNSScreenRemovalListener.h"
|
|
2
|
+
#include <react/renderer/mounting/ShadowViewMutation.h>
|
|
3
|
+
using namespace facebook::react;
|
|
4
|
+
|
|
5
|
+
std::optional<MountingTransaction> RNSScreenRemovalListener::pullTransaction(
|
|
6
|
+
SurfaceId surfaceId,
|
|
7
|
+
MountingTransaction::Number transactionNumber,
|
|
8
|
+
const TransactionTelemetry &telemetry,
|
|
9
|
+
ShadowViewMutationList mutations) const {
|
|
10
|
+
for (const ShadowViewMutation &mutation : mutations) {
|
|
11
|
+
if (mutation.type == ShadowViewMutation::Type::Remove &&
|
|
12
|
+
mutation.oldChildShadowView.componentName != nullptr &&
|
|
13
|
+
strcmp(mutation.parentShadowView.componentName, "RNSScreenStack") ==
|
|
14
|
+
0) {
|
|
15
|
+
listenerFunction_(mutation.oldChildShadowView.tag);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return MountingTransaction{
|
|
20
|
+
surfaceId, transactionNumber, std::move(mutations), telemetry};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bool RNSScreenRemovalListener::shouldOverridePullTransaction() const {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
|
|
4
|
+
#include <react/renderer/mounting/MountingOverrideDelegate.h>
|
|
5
|
+
#include <react/renderer/mounting/ShadowView.h>
|
|
6
|
+
|
|
7
|
+
using namespace facebook::react;
|
|
8
|
+
|
|
9
|
+
struct RNSScreenRemovalListener : public MountingOverrideDelegate {
|
|
10
|
+
std::function<void(int)> listenerFunction_;
|
|
11
|
+
RNSScreenRemovalListener(std::function<void(int)> &&listenerFunction_)
|
|
12
|
+
: listenerFunction_(std::move(listenerFunction_)) {}
|
|
13
|
+
|
|
14
|
+
bool shouldOverridePullTransaction() const override;
|
|
15
|
+
std::optional<MountingTransaction> pullTransaction(
|
|
16
|
+
SurfaceId surfaceId,
|
|
17
|
+
MountingTransaction::Number number,
|
|
18
|
+
const TransactionTelemetry &telemetry,
|
|
19
|
+
ShadowViewMutationList mutations) const override;
|
|
20
|
+
};
|
package/ios/RNSConvert.h
CHANGED
package/ios/RNSModalScreen.mm
CHANGED
|
@@ -7,6 +7,28 @@
|
|
|
7
7
|
|
|
8
8
|
@implementation RNSModalScreen
|
|
9
9
|
|
|
10
|
+
// When using UIModalPresentationStyleFullScreen the whole view hierarchy mounted under primary `UITransitionView` is
|
|
11
|
+
// removed, including React's root view, which observes for trait collection changes & sends it to `Appearance` module
|
|
12
|
+
// via system notification centre. To workaround this detached-root-view-situation we emit the event to React's
|
|
13
|
+
// `Appearance` module ourselves. For the RCTRootView observer, visit
|
|
14
|
+
// https://github.com/facebook/react-native/blob/d3e0430deac573fd44792e6005d5de20e9ad2797/packages/react-native/React/Base/RCTRootView.m#L362
|
|
15
|
+
// For more information, see https://github.com/software-mansion/react-native-screens/pull/2211.
|
|
16
|
+
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
|
|
17
|
+
{
|
|
18
|
+
[super traitCollectionDidChange:previousTraitCollection];
|
|
19
|
+
if (RCTSharedApplication().applicationState == UIApplicationStateBackground ||
|
|
20
|
+
self.stackPresentation != RNSScreenStackPresentationFullScreenModal) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[[NSNotificationCenter defaultCenter]
|
|
25
|
+
postNotificationName:RCTUserInterfaceStyleDidChangeNotification
|
|
26
|
+
object:self
|
|
27
|
+
userInfo:@{
|
|
28
|
+
RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey : self.traitCollection,
|
|
29
|
+
}];
|
|
30
|
+
}
|
|
31
|
+
|
|
10
32
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
11
33
|
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
12
34
|
{
|
package/ios/RNSModule.mm
CHANGED
|
@@ -116,7 +116,7 @@ RCT_EXPORT_MODULE()
|
|
|
116
116
|
{
|
|
117
117
|
RNSScreenStackView *view = [self getScreenStackView:stackTag];
|
|
118
118
|
if (view != nil && ![view isKindOfClass:[RNSScreenStackView class]]) {
|
|
119
|
-
RCTLogError(@"Invalid view type, expecting RNSScreenStackView, got: %@", view);
|
|
119
|
+
RCTLogError(@"[RNScreens] Invalid view type, expecting RNSScreenStackView, got: %@", view);
|
|
120
120
|
return nil;
|
|
121
121
|
}
|
|
122
122
|
return view;
|
package/ios/RNSScreen.h
CHANGED
|
@@ -40,7 +40,7 @@ namespace react = facebook::react;
|
|
|
40
40
|
- (void)notifyFinishTransitioning;
|
|
41
41
|
- (RNSScreenView *)screenView;
|
|
42
42
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
43
|
-
- (void)setViewToSnapshot
|
|
43
|
+
- (void)setViewToSnapshot;
|
|
44
44
|
- (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal;
|
|
45
45
|
#endif
|
|
46
46
|
|
|
@@ -56,6 +56,7 @@ namespace react = facebook::react;
|
|
|
56
56
|
#endif
|
|
57
57
|
|
|
58
58
|
@property (nonatomic) BOOL fullScreenSwipeEnabled;
|
|
59
|
+
@property (nonatomic) BOOL fullScreenSwipeShadowEnabled;
|
|
59
60
|
@property (nonatomic) BOOL gestureEnabled;
|
|
60
61
|
@property (nonatomic) BOOL hasStatusBarHiddenSet;
|
|
61
62
|
@property (nonatomic) BOOL hasStatusBarStyleSet;
|
package/ios/RNSScreen.mm
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
#import "RNSScreenStack.h"
|
|
26
26
|
#import "RNSScreenStackHeaderConfig.h"
|
|
27
27
|
|
|
28
|
+
#import "UIView+RNSUtility.h"
|
|
29
|
+
|
|
28
30
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
29
31
|
namespace react = facebook::react;
|
|
30
32
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -414,7 +416,7 @@ namespace react = facebook::react;
|
|
|
414
416
|
[[RNSHeaderHeightChangeEvent alloc] initWithEventName:@"onHeaderHeightChange"
|
|
415
417
|
reactTag:[NSNumber numberWithInt:self.tag]
|
|
416
418
|
headerHeight:headerHeight];
|
|
417
|
-
[
|
|
419
|
+
[self postNotificationForEventDispatcherObserversWithEvent:event];
|
|
418
420
|
#else
|
|
419
421
|
if (self.onHeaderHeightChange) {
|
|
420
422
|
self.onHeaderHeightChange(@{
|
|
@@ -473,22 +475,13 @@ namespace react = facebook::react;
|
|
|
473
475
|
}
|
|
474
476
|
}
|
|
475
477
|
|
|
476
|
-
|
|
477
|
-
- (RCTSurfaceTouchHandler *)touchHandler
|
|
478
|
-
#else
|
|
479
|
-
- (RCTTouchHandler *)touchHandler
|
|
480
|
-
#endif
|
|
478
|
+
- (nullable RNS_TOUCH_HANDLER_ARCH_TYPE *)touchHandler
|
|
481
479
|
{
|
|
482
480
|
if (_touchHandler != nil) {
|
|
483
481
|
return _touchHandler;
|
|
484
482
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
parent = parent.superview;
|
|
488
|
-
if (parent != nil) {
|
|
489
|
-
return [parent performSelector:@selector(touchHandler)];
|
|
490
|
-
}
|
|
491
|
-
return nil;
|
|
483
|
+
|
|
484
|
+
return [self rnscreens_findTouchHandlerInAncestorChain];
|
|
492
485
|
}
|
|
493
486
|
|
|
494
487
|
- (void)notifyFinishTransitioning
|
|
@@ -509,7 +502,7 @@ namespace react = facebook::react;
|
|
|
509
502
|
progress:progress
|
|
510
503
|
closing:closing
|
|
511
504
|
goingForward:goingForward];
|
|
512
|
-
[
|
|
505
|
+
[self postNotificationForEventDispatcherObserversWithEvent:event];
|
|
513
506
|
#else
|
|
514
507
|
if (self.onTransitionProgress) {
|
|
515
508
|
self.onTransitionProgress(@{
|
|
@@ -667,6 +660,14 @@ namespace react = facebook::react;
|
|
|
667
660
|
#pragma mark - Fabric specific
|
|
668
661
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
669
662
|
|
|
663
|
+
- (void)postNotificationForEventDispatcherObserversWithEvent:(NSObject<RCTEvent> *)event
|
|
664
|
+
{
|
|
665
|
+
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:event, @"event", nil];
|
|
666
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED"
|
|
667
|
+
object:nil
|
|
668
|
+
userInfo:userInfo];
|
|
669
|
+
}
|
|
670
|
+
|
|
670
671
|
- (BOOL)hasHeaderConfig
|
|
671
672
|
{
|
|
672
673
|
return _config != nil;
|
|
@@ -710,6 +711,8 @@ namespace react = facebook::react;
|
|
|
710
711
|
|
|
711
712
|
[self setFullScreenSwipeEnabled:newScreenProps.fullScreenSwipeEnabled];
|
|
712
713
|
|
|
714
|
+
[self setFullScreenSwipeShadowEnabled:newScreenProps.fullScreenSwipeShadowEnabled];
|
|
715
|
+
|
|
713
716
|
[self setGestureEnabled:newScreenProps.gestureEnabled];
|
|
714
717
|
|
|
715
718
|
[self setTransitionDuration:[NSNumber numberWithInt:newScreenProps.transitionDuration]];
|
|
@@ -793,7 +796,7 @@ namespace react = facebook::react;
|
|
|
793
796
|
_newLayoutMetrics = layoutMetrics;
|
|
794
797
|
_oldLayoutMetrics = oldLayoutMetrics;
|
|
795
798
|
UIViewController *parentVC = self.reactViewController.parentViewController;
|
|
796
|
-
if (parentVC
|
|
799
|
+
if (parentVC == nil || ![parentVC isKindOfClass:[RNSNavigationController class]]) {
|
|
797
800
|
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
798
801
|
}
|
|
799
802
|
// when screen is mounted under RNSNavigationController it's size is controller
|
|
@@ -1388,12 +1391,16 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
1388
1391
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1389
1392
|
#pragma mark - Fabric specific
|
|
1390
1393
|
|
|
1391
|
-
- (void)setViewToSnapshot
|
|
1394
|
+
- (void)setViewToSnapshot
|
|
1392
1395
|
{
|
|
1393
1396
|
UIView *superView = self.view.superview;
|
|
1394
|
-
|
|
1395
|
-
self.view
|
|
1396
|
-
|
|
1397
|
+
// if we dismissed the view natively, it will already be detached from view hierarchy
|
|
1398
|
+
if (self.view.window != nil) {
|
|
1399
|
+
UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:NO];
|
|
1400
|
+
[self.view removeFromSuperview];
|
|
1401
|
+
self.view = snapshot;
|
|
1402
|
+
[superView addSubview:snapshot];
|
|
1403
|
+
}
|
|
1397
1404
|
}
|
|
1398
1405
|
|
|
1399
1406
|
#else
|
|
@@ -1434,6 +1441,7 @@ RCT_EXPORT_MODULE()
|
|
|
1434
1441
|
RCT_REMAP_VIEW_PROPERTY(activityState, activityStateOrNil, NSNumber)
|
|
1435
1442
|
RCT_EXPORT_VIEW_PROPERTY(customAnimationOnSwipe, BOOL);
|
|
1436
1443
|
RCT_EXPORT_VIEW_PROPERTY(fullScreenSwipeEnabled, BOOL);
|
|
1444
|
+
RCT_EXPORT_VIEW_PROPERTY(fullScreenSwipeShadowEnabled, BOOL);
|
|
1437
1445
|
RCT_EXPORT_VIEW_PROPERTY(gestureEnabled, BOOL)
|
|
1438
1446
|
RCT_EXPORT_VIEW_PROPERTY(gestureResponseDistance, NSDictionary)
|
|
1439
1447
|
RCT_EXPORT_VIEW_PROPERTY(hideKeyboardOnSwipe, BOOL)
|
package/ios/RNSScreenStack.mm
CHANGED
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
#import "RNSScreenStackHeaderConfig.h"
|
|
27
27
|
#import "RNSScreenWindowTraits.h"
|
|
28
28
|
|
|
29
|
+
#import "UIView+RNSUtility.h"
|
|
30
|
+
|
|
29
31
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
30
32
|
namespace react = facebook::react;
|
|
31
33
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -116,12 +118,8 @@ namespace react = facebook::react;
|
|
|
116
118
|
BOOL _invalidated;
|
|
117
119
|
BOOL _isFullWidthSwiping;
|
|
118
120
|
UIPercentDrivenInteractiveTransition *_interactionController;
|
|
119
|
-
BOOL _hasLayout;
|
|
120
121
|
__weak RNSScreenStackManager *_manager;
|
|
121
122
|
BOOL _updateScheduled;
|
|
122
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
123
|
-
UIView *_snapshot;
|
|
124
|
-
#endif
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -140,7 +138,6 @@ namespace react = facebook::react;
|
|
|
140
138
|
- (instancetype)initWithManager:(RNSScreenStackManager *)manager
|
|
141
139
|
{
|
|
142
140
|
if (self = [super init]) {
|
|
143
|
-
_hasLayout = NO;
|
|
144
141
|
_invalidated = NO;
|
|
145
142
|
_manager = manager;
|
|
146
143
|
[self initCommonProps];
|
|
@@ -270,18 +267,9 @@ namespace react = facebook::react;
|
|
|
270
267
|
- (void)maybeAddToParentAndUpdateContainer
|
|
271
268
|
{
|
|
272
269
|
BOOL wasScreenMounted = _controller.parentViewController != nil;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
BOOL isScreenReadyForShowing = self.window && _hasLayout;
|
|
277
|
-
#endif
|
|
278
|
-
if (!isScreenReadyForShowing && !wasScreenMounted) {
|
|
279
|
-
// We wait with adding to parent controller until the stack is mounted and has its initial
|
|
280
|
-
// layout done.
|
|
281
|
-
// If we add it before layout, some of the items (specifically items from the navigation bar),
|
|
282
|
-
// won't be able to position properly. Also the position and size of such items, even if it
|
|
283
|
-
// happens to change, won't be properly updated (this is perhaps some internal issue of UIKit).
|
|
284
|
-
// If we add it when window is not attached, some of the view transitions will be bloced (i.e.
|
|
270
|
+
if (!self.window && !wasScreenMounted) {
|
|
271
|
+
// We wait with adding to parent controller until the stack is mounted.
|
|
272
|
+
// If we add it when window is not attached, some of the view transitions will be blocked (i.e.
|
|
285
273
|
// modal transitions) and the internal view controler's state will get out of sync with what's
|
|
286
274
|
// on screen without us knowing.
|
|
287
275
|
return;
|
|
@@ -735,43 +723,8 @@ namespace react = facebook::react;
|
|
|
735
723
|
// item is close to an edge and we start pulling from edge we want the Touchable to be cancelled.
|
|
736
724
|
// Without the below code the Touchable will remain active (highlighted) for the duration of back
|
|
737
725
|
// gesture and onPress may fire when we release the finger.
|
|
738
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
739
|
-
// On Fabric there is no view that exposes touchHandler above us in the view hierarchy, however it is still
|
|
740
|
-
// utilised. `RCTSurfaceView` should be present above us, which hosts `RCTFabricSurface` instance, which in turn
|
|
741
|
-
// hosts `RCTSurfaceTouchHandler` as a private field. When initialised, `RCTSurfaceTouchHandler` is attached to the
|
|
742
|
-
// surface view as a gestureRecognizer <- and this is where we can lay our hands on it.
|
|
743
|
-
UIView *parent = _controller.view;
|
|
744
|
-
while (parent != nil && ![parent isKindOfClass:RCTSurfaceView.class]) {
|
|
745
|
-
parent = parent.superview;
|
|
746
|
-
}
|
|
747
726
|
|
|
748
|
-
|
|
749
|
-
if (parent == nil) {
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
RCTSurfaceTouchHandler *touchHandler = nil;
|
|
754
|
-
// Experimentation shows that RCTSurfaceTouchHandler is the only gestureRecognizer registered here,
|
|
755
|
-
// so we should not be afraid of any performance hit here.
|
|
756
|
-
for (UIGestureRecognizer *recognizer in parent.gestureRecognizers) {
|
|
757
|
-
if ([recognizer isKindOfClass:RCTSurfaceTouchHandler.class]) {
|
|
758
|
-
touchHandler = static_cast<RCTSurfaceTouchHandler *>(recognizer);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
[touchHandler rnscreens_cancelTouches];
|
|
763
|
-
#else
|
|
764
|
-
// On Paper we can access touchHandler hosted by `RCTRootContentView` which should be above ScreenStack
|
|
765
|
-
// in view hierarchy.
|
|
766
|
-
UIView *parent = _controller.view;
|
|
767
|
-
while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)]) {
|
|
768
|
-
parent = parent.superview;
|
|
769
|
-
}
|
|
770
|
-
if (parent != nil) {
|
|
771
|
-
RCTTouchHandler *touchHandler = [parent performSelector:@selector(touchHandler)];
|
|
772
|
-
[touchHandler rnscreens_cancelTouches];
|
|
773
|
-
}
|
|
774
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
727
|
+
[[self rnscreens_findTouchHandlerInAncestorChain] rnscreens_cancelTouches];
|
|
775
728
|
}
|
|
776
729
|
|
|
777
730
|
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
|
@@ -905,6 +858,7 @@ namespace react = facebook::react;
|
|
|
905
858
|
[_interactionController cancelInteractiveTransition];
|
|
906
859
|
}
|
|
907
860
|
_interactionController = nil;
|
|
861
|
+
_isFullWidthSwiping = NO;
|
|
908
862
|
}
|
|
909
863
|
default: {
|
|
910
864
|
break;
|
|
@@ -1109,7 +1063,6 @@ namespace react = facebook::react;
|
|
|
1109
1063
|
// set yet, however the layout call is already enqueued on ui thread. Enqueuing update call on the
|
|
1110
1064
|
// ui queue will guarantee that the update will run after layout.
|
|
1111
1065
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1112
|
-
self->_hasLayout = YES;
|
|
1113
1066
|
[self maybeAddToParentAndUpdateContainer];
|
|
1114
1067
|
});
|
|
1115
1068
|
}
|
|
@@ -1161,14 +1114,14 @@ namespace react = facebook::react;
|
|
|
1161
1114
|
|
|
1162
1115
|
[_reactSubviews insertObject:(RNSScreenView *)childComponentView atIndex:index];
|
|
1163
1116
|
((RNSScreenView *)childComponentView).reactSuperview = self;
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
});
|
|
1117
|
+
// Container update is done after all mount operations are executed in
|
|
1118
|
+
// `- [RNSScreenStackView mountingTransactionDidMount: withSurfaceTelemetry:]`
|
|
1167
1119
|
}
|
|
1168
1120
|
|
|
1169
1121
|
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
1170
1122
|
{
|
|
1171
1123
|
RNSScreenView *screenChildComponent = (RNSScreenView *)childComponentView;
|
|
1124
|
+
|
|
1172
1125
|
// We should only do a snapshot of a screen that is on the top.
|
|
1173
1126
|
// We also check `_presentedModals` since if you push 2 modals, second one is not a "child" of _controller.
|
|
1174
1127
|
// Also, when dissmised with a gesture, the screen already is not under the window, so we don't need to apply
|
|
@@ -1176,7 +1129,7 @@ namespace react = facebook::react;
|
|
|
1176
1129
|
if (screenChildComponent.window != nil &&
|
|
1177
1130
|
((screenChildComponent == _controller.visibleViewController.view && _presentedModals.count < 2) ||
|
|
1178
1131
|
screenChildComponent == [_presentedModals.lastObject view])) {
|
|
1179
|
-
[screenChildComponent.controller setViewToSnapshot
|
|
1132
|
+
[screenChildComponent.controller setViewToSnapshot];
|
|
1180
1133
|
}
|
|
1181
1134
|
|
|
1182
1135
|
RCTAssert(
|
|
@@ -1196,28 +1149,22 @@ namespace react = facebook::react;
|
|
|
1196
1149
|
screenChildComponent.reactSuperview = nil;
|
|
1197
1150
|
[_reactSubviews removeObject:screenChildComponent];
|
|
1198
1151
|
[screenChildComponent removeFromSuperview];
|
|
1199
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1200
|
-
[self maybeAddToParentAndUpdateContainer];
|
|
1201
|
-
});
|
|
1202
1152
|
}
|
|
1203
1153
|
|
|
1204
|
-
- (void)
|
|
1154
|
+
- (void)mountingTransactionDidMount:(const facebook::react::MountingTransaction &)transaction
|
|
1155
|
+
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
|
|
1205
1156
|
{
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
if (mutation.type == react::ShadowViewMutation::Type::Remove && mutation.parentShadowView.componentName != nil &&
|
|
1218
|
-
strcmp(mutation.parentShadowView.componentName, "RNSScreenStack") == 0) {
|
|
1219
|
-
[self takeSnapshot];
|
|
1220
|
-
return;
|
|
1157
|
+
for (const auto &mutation : transaction.getMutations()) {
|
|
1158
|
+
if (mutation.parentShadowView.tag == self.tag &&
|
|
1159
|
+
(mutation.type == react::ShadowViewMutation::Type::Insert ||
|
|
1160
|
+
mutation.type == react::ShadowViewMutation::Type::Remove)) {
|
|
1161
|
+
// we need to wait until children have their layout set. At this point they don't have the layout
|
|
1162
|
+
// set yet, however the layout call is already enqueued on ui thread. Enqueuing update call on the
|
|
1163
|
+
// ui queue will guarantee that the update will run after layout.
|
|
1164
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1165
|
+
[self maybeAddToParentAndUpdateContainer];
|
|
1166
|
+
});
|
|
1167
|
+
break;
|
|
1221
1168
|
}
|
|
1222
1169
|
}
|
|
1223
1170
|
}
|