react-native-screens 4.7.0-beta.1 → 4.7.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +19 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +21 -5
- package/ios/RNSScreen.h +17 -4
- package/ios/RNSScreen.mm +32 -13
- package/ios/RNSScreenContentWrapper.h +2 -2
- package/ios/RNSScreenContentWrapper.mm +68 -11
- package/ios/RNSScreenStack.mm +12 -1
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -95,6 +95,14 @@ def safeAppExtGet(prop, fallback) {
|
|
|
95
95
|
appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
99
|
+
|
|
100
|
+
def reactProperties = new Properties()
|
|
101
|
+
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
102
|
+
|
|
103
|
+
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
104
|
+
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
105
|
+
|
|
98
106
|
def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
|
|
99
107
|
|
|
100
108
|
android {
|
|
@@ -166,6 +174,7 @@ android {
|
|
|
166
174
|
sourceSets.main {
|
|
167
175
|
ext.androidResDir = "src/main/res"
|
|
168
176
|
java {
|
|
177
|
+
// Architecture specific
|
|
169
178
|
if (IS_NEW_ARCHITECTURE_ENABLED) {
|
|
170
179
|
srcDirs += [
|
|
171
180
|
"src/fabric/java",
|
|
@@ -175,6 +184,15 @@ android {
|
|
|
175
184
|
"src/paper/java",
|
|
176
185
|
]
|
|
177
186
|
}
|
|
187
|
+
|
|
188
|
+
// Background color resolving
|
|
189
|
+
if (REACT_NATIVE_MINOR_VERSION <= 74) {
|
|
190
|
+
srcDirs += "src/versioned/backgroundcolor/74"
|
|
191
|
+
} else if (REACT_NATIVE_MINOR_VERSION <= 76) {
|
|
192
|
+
srcDirs += "src/versioned/backgroundcolor/76"
|
|
193
|
+
} else {
|
|
194
|
+
srcDirs += "src/versioned/backgroundcolor/latest"
|
|
195
|
+
}
|
|
178
196
|
}
|
|
179
197
|
res {
|
|
180
198
|
if (safeExtGet(['compileSdkVersion', 'compileSdk'], rnsDefaultCompileSdkVersion) >= 33) {
|
|
@@ -188,7 +206,7 @@ android {
|
|
|
188
206
|
|
|
189
207
|
repositories {
|
|
190
208
|
maven {
|
|
191
|
-
url "${
|
|
209
|
+
url "${reactNativeRootDir}/android"
|
|
192
210
|
}
|
|
193
211
|
|
|
194
212
|
mavenCentral()
|
|
@@ -25,7 +25,6 @@ import android.widget.LinearLayout
|
|
|
25
25
|
import androidx.annotation.RequiresApi
|
|
26
26
|
import androidx.appcompat.widget.Toolbar
|
|
27
27
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
28
|
-
import androidx.core.animation.addListener
|
|
29
28
|
import androidx.core.view.WindowInsetsCompat
|
|
30
29
|
import com.facebook.react.uimanager.PixelUtil
|
|
31
30
|
import com.facebook.react.uimanager.PointerEvents
|
|
@@ -51,6 +50,7 @@ import com.swmansion.rnscreens.events.ScreenEventDelegate
|
|
|
51
50
|
import com.swmansion.rnscreens.ext.recycle
|
|
52
51
|
import com.swmansion.rnscreens.transition.ExternalBoundaryValuesEvaluator
|
|
53
52
|
import com.swmansion.rnscreens.utils.DeviceUtils
|
|
53
|
+
import com.swmansion.rnscreens.utils.resolveBackgroundColor
|
|
54
54
|
|
|
55
55
|
sealed class KeyboardState
|
|
56
56
|
|
|
@@ -574,6 +574,24 @@ class ScreenStackFragment :
|
|
|
574
574
|
private fun createAndConfigureBottomSheetBehaviour(): BottomSheetBehavior<Screen> =
|
|
575
575
|
configureBottomSheetBehaviour(createBottomSheetBehaviour())
|
|
576
576
|
|
|
577
|
+
private fun resolveBackgroundColor(screen: Screen): Int? {
|
|
578
|
+
val screenColor =
|
|
579
|
+
(screen.background as? ColorDrawable?)?.color
|
|
580
|
+
?: (screen.background as? MaterialShapeDrawable?)?.tintList?.defaultColor
|
|
581
|
+
|
|
582
|
+
if (screenColor != null) {
|
|
583
|
+
return screenColor
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
val contentWrapper = screen.contentWrapper.get()
|
|
587
|
+
if (contentWrapper == null) {
|
|
588
|
+
return null
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
val contentWrapperColor = contentWrapper.resolveBackgroundColor()
|
|
592
|
+
return contentWrapperColor
|
|
593
|
+
}
|
|
594
|
+
|
|
577
595
|
private fun attachShapeToScreen(screen: Screen) {
|
|
578
596
|
val cornerSize = PixelUtil.toPixelFromDIP(screen.sheetCornerRadius)
|
|
579
597
|
val shapeAppearanceModel =
|
|
@@ -584,10 +602,8 @@ class ScreenStackFragment :
|
|
|
584
602
|
setTopRightCorner(CornerFamily.ROUNDED, cornerSize)
|
|
585
603
|
}.build()
|
|
586
604
|
val shape = MaterialShapeDrawable(shapeAppearanceModel)
|
|
587
|
-
val
|
|
588
|
-
|
|
589
|
-
?: (screen.background as? MaterialShapeDrawable?)?.tintList?.defaultColor
|
|
590
|
-
shape.setTint(currentColor ?: Color.TRANSPARENT)
|
|
605
|
+
val backgroundColor = resolveBackgroundColor(screen)
|
|
606
|
+
shape.setTint(backgroundColor ?: Color.TRANSPARENT)
|
|
591
607
|
screen.background = shape
|
|
592
608
|
}
|
|
593
609
|
|
package/ios/RNSScreen.h
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#import "RNSEnums.h"
|
|
5
5
|
#import "RNSScreenContainer.h"
|
|
6
|
+
#import "RNSScreenContentWrapper.h"
|
|
6
7
|
|
|
7
8
|
#if RCT_NEW_ARCH_ENABLED
|
|
8
9
|
#import <React/RCTViewComponentView.h>
|
|
@@ -54,6 +55,7 @@ namespace react = facebook::react;
|
|
|
54
55
|
#else
|
|
55
56
|
RCTView
|
|
56
57
|
#endif
|
|
58
|
+
<RNSScreenContentWrapperDelegate>
|
|
57
59
|
|
|
58
60
|
@property (nonatomic) BOOL fullScreenSwipeEnabled;
|
|
59
61
|
@property (nonatomic) BOOL fullScreenSwipeShadowEnabled;
|
|
@@ -126,9 +128,12 @@ namespace react = facebook::react;
|
|
|
126
128
|
- (void)updateBounds;
|
|
127
129
|
- (void)notifyDismissedWithCount:(int)dismissCount;
|
|
128
130
|
- (instancetype)initWithFrame:(CGRect)frame;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Tell `Screen` that it will be unmounted in next transaction.
|
|
134
|
+
* The component needs this so that we can later decide whether to
|
|
135
|
+
* replace it with snapshot or not.
|
|
136
|
+
*/
|
|
132
137
|
- (void)willBeUnmountedInUpcomingTransaction;
|
|
133
138
|
#else
|
|
134
139
|
- (instancetype)initWithBridge:(RCTBridge *)bridge;
|
|
@@ -147,9 +152,17 @@ namespace react = facebook::react;
|
|
|
147
152
|
*/
|
|
148
153
|
- (void)invalidate;
|
|
149
154
|
|
|
150
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Looks for header configuration in instance's `reactSubviews` and returns it. If not present returns `nil`.
|
|
157
|
+
*/
|
|
151
158
|
- (RNSScreenStackHeaderConfig *_Nullable)findHeaderConfig;
|
|
152
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Returns `YES` if the wrapper has been registered and it should not attempt to register on screen views higher in the
|
|
162
|
+
* tree.
|
|
163
|
+
*/
|
|
164
|
+
- (BOOL)registerContentWrapper:(nonnull RNSScreenContentWrapper *)contentWrapper contentHeightErrata:(float)errata;
|
|
165
|
+
|
|
153
166
|
@end
|
|
154
167
|
|
|
155
168
|
@interface UIView (RNSScreen)
|
package/ios/RNSScreen.mm
CHANGED
|
@@ -44,9 +44,13 @@ namespace react = facebook::react;
|
|
|
44
44
|
constexpr NSInteger SHEET_FIT_TO_CONTENTS = -1;
|
|
45
45
|
constexpr NSInteger SHEET_LARGEST_UNDIMMED_DETENT_NONE = -1;
|
|
46
46
|
|
|
47
|
+
struct ContentWrapperBox {
|
|
48
|
+
__weak RNSScreenContentWrapper *contentWrapper{nil};
|
|
49
|
+
float contentHeightErrata{0.f};
|
|
50
|
+
};
|
|
51
|
+
|
|
47
52
|
@interface RNSScreenView () <
|
|
48
53
|
UIAdaptivePresentationControllerDelegate,
|
|
49
|
-
RNSScreenContentWrapperDelegate,
|
|
50
54
|
#if !TARGET_OS_TV
|
|
51
55
|
UISheetPresentationControllerDelegate,
|
|
52
56
|
#endif
|
|
@@ -62,12 +66,12 @@ constexpr NSInteger SHEET_LARGEST_UNDIMMED_DETENT_NONE = -1;
|
|
|
62
66
|
@implementation RNSScreenView {
|
|
63
67
|
__weak ReactScrollViewBase *_sheetsScrollView;
|
|
64
68
|
BOOL _didSetSheetAllowedDetentsOnController;
|
|
69
|
+
ContentWrapperBox _contentWrapperBox;
|
|
65
70
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
66
71
|
RCTSurfaceTouchHandler *_touchHandler;
|
|
67
72
|
react::RNSScreenShadowNode::ConcreteState::Shared _state;
|
|
68
73
|
// on fabric, they are not available by default so we need them exposed here too
|
|
69
74
|
NSMutableArray<UIView *> *_reactSubviews;
|
|
70
|
-
__weak RNSScreenContentWrapper *_contentWrapper;
|
|
71
75
|
#else
|
|
72
76
|
__weak RCTBridge *_bridge;
|
|
73
77
|
RCTTouchHandler *_touchHandler;
|
|
@@ -89,7 +93,7 @@ constexpr NSInteger SHEET_LARGEST_UNDIMMED_DETENT_NONE = -1;
|
|
|
89
93
|
static const auto defaultProps = std::make_shared<const react::RNSScreenProps>();
|
|
90
94
|
_props = defaultProps;
|
|
91
95
|
_reactSubviews = [NSMutableArray new];
|
|
92
|
-
|
|
96
|
+
_contentWrapperBox = {};
|
|
93
97
|
[self initCommonProps];
|
|
94
98
|
}
|
|
95
99
|
return self;
|
|
@@ -384,8 +388,19 @@ RNS_IGNORE_SUPER_CALL_BEGIN
|
|
|
384
388
|
}
|
|
385
389
|
RNS_IGNORE_SUPER_CALL_END
|
|
386
390
|
|
|
391
|
+
- (BOOL)registerContentWrapper:(RNSScreenContentWrapper *)contentWrapper contentHeightErrata:(float)errata;
|
|
392
|
+
{
|
|
393
|
+
if (self.stackPresentation != RNSScreenStackPresentationFormSheet) {
|
|
394
|
+
return NO;
|
|
395
|
+
}
|
|
396
|
+
_contentWrapperBox = {.contentWrapper = contentWrapper, .contentHeightErrata = errata};
|
|
397
|
+
contentWrapper.delegate = self;
|
|
398
|
+
[contentWrapper triggerDelegateUpdate];
|
|
399
|
+
return YES;
|
|
400
|
+
}
|
|
401
|
+
|
|
387
402
|
/// This is RNSScreenContentWrapperDelegate method, where we do get notified when React did update frame of our child.
|
|
388
|
-
- (void)
|
|
403
|
+
- (void)contentWrapper:(RNSScreenContentWrapper *)contentWrapper receivedReactFrame:(CGRect)reactFrame
|
|
389
404
|
{
|
|
390
405
|
if (self.stackPresentation != RNSScreenStackPresentationFormSheet || _didSetSheetAllowedDetentsOnController == YES) {
|
|
391
406
|
return;
|
|
@@ -403,7 +418,8 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
403
418
|
}
|
|
404
419
|
|
|
405
420
|
if (_sheetAllowedDetents.count > 0 && _sheetAllowedDetents[0].intValue == SHEET_FIT_TO_CONTENTS) {
|
|
406
|
-
auto detents = [self detentsFromMaxHeights:@[ [NSNumber numberWithFloat:reactFrame.size.height
|
|
421
|
+
auto detents = [self detentsFromMaxHeights:@[ [NSNumber numberWithFloat:reactFrame.size.height +
|
|
422
|
+
_contentWrapperBox.contentHeightErrata] ]];
|
|
407
423
|
[self setAllowedDetentsForSheet:sheetController to:detents animate:YES];
|
|
408
424
|
}
|
|
409
425
|
}
|
|
@@ -416,6 +432,7 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
416
432
|
if ([view isKindOfClass:RNSScreenContentWrapper.class] &&
|
|
417
433
|
self.stackPresentation == RNSScreenStackPresentationFormSheet) {
|
|
418
434
|
auto contentWrapper = (RNSScreenContentWrapper *)view;
|
|
435
|
+
_contentWrapperBox.contentWrapper = contentWrapper;
|
|
419
436
|
contentWrapper.delegate = self;
|
|
420
437
|
}
|
|
421
438
|
|
|
@@ -902,6 +919,7 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
902
919
|
if (_stackPresentation != RNSScreenStackPresentationFormSheet) {
|
|
903
920
|
return;
|
|
904
921
|
}
|
|
922
|
+
|
|
905
923
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_15_0) && \
|
|
906
924
|
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
|
|
907
925
|
int firstDimmedDetentIndex = _sheetAllowedDetents.count;
|
|
@@ -926,8 +944,10 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
926
944
|
// Paper: we do not set anything here, we will set once React computed layout of our React's children, namely
|
|
927
945
|
// RNSScreenContentWrapper, which in case of formSheet presentation style does have exactly the same frame as
|
|
928
946
|
// actual content. The update will be triggered once our child is mounted and laid out by React.
|
|
929
|
-
// Fabric: in this very moment our children are already mounted & laid out. In the very end
|
|
930
|
-
// after all other configuration is applied we trigger content wrapper to send us update on
|
|
947
|
+
// Fabric: no nested stack: in this very moment our children are already mounted & laid out. In the very end
|
|
948
|
+
// of this method, after all other configuration is applied we trigger content wrapper to send us update on
|
|
949
|
+
// its frame. Fabric: nested stack: we wait until nested content wrapper registers itself with this view and
|
|
950
|
+
// then update the dimensions.
|
|
931
951
|
} else {
|
|
932
952
|
[self setAllowedDetentsForSheet:sheet
|
|
933
953
|
to:[self detentsFromMaxHeightFractions:_sheetAllowedDetents]
|
|
@@ -1030,7 +1050,7 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
1030
1050
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1031
1051
|
// We trigger update from content wrapper, because on Fabric we update props after the children are mounted & laid
|
|
1032
1052
|
// out.
|
|
1033
|
-
[self->
|
|
1053
|
+
[self->_contentWrapperBox.contentWrapper triggerDelegateUpdate];
|
|
1034
1054
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
1035
1055
|
#endif // Check for iOS >= 15
|
|
1036
1056
|
}
|
|
@@ -1122,9 +1142,8 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
1122
1142
|
if ([childComponentView isKindOfClass:RNSScreenContentWrapper.class]) {
|
|
1123
1143
|
auto contentWrapper = (RNSScreenContentWrapper *)childComponentView;
|
|
1124
1144
|
contentWrapper.delegate = self;
|
|
1125
|
-
|
|
1126
|
-
}
|
|
1127
|
-
if ([childComponentView isKindOfClass:[RNSScreenStackHeaderConfig class]]) {
|
|
1145
|
+
_contentWrapperBox.contentWrapper = contentWrapper;
|
|
1146
|
+
} else if ([childComponentView isKindOfClass:RNSScreenStackHeaderConfig.class]) {
|
|
1128
1147
|
_config = (RNSScreenStackHeaderConfig *)childComponentView;
|
|
1129
1148
|
_config.screenView = self;
|
|
1130
1149
|
}
|
|
@@ -1138,8 +1157,8 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
1138
1157
|
_config = nil;
|
|
1139
1158
|
}
|
|
1140
1159
|
if ([childComponentView isKindOfClass:[RNSScreenContentWrapper class]]) {
|
|
1141
|
-
|
|
1142
|
-
|
|
1160
|
+
_contentWrapperBox.contentWrapper.delegate = nil;
|
|
1161
|
+
_contentWrapperBox.contentWrapper = nil;
|
|
1143
1162
|
}
|
|
1144
1163
|
[_reactSubviews removeObject:childComponentView];
|
|
1145
1164
|
[super unmountChildComponentView:childComponentView index:index];
|
|
@@ -15,9 +15,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
15
15
|
@protocol RNSScreenContentWrapperDelegate <NSObject>
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Called by the content wrapper on a delegate when React Native updates the layout.
|
|
19
19
|
*/
|
|
20
|
-
- (void)
|
|
20
|
+
- (void)contentWrapper:(RNSScreenContentWrapper *)contentWrapper receivedReactFrame:(CGRect)reactFrame;
|
|
21
21
|
|
|
22
22
|
@end
|
|
23
23
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#import "RNSScreenContentWrapper.h"
|
|
2
|
+
#import "RNSScreen.h"
|
|
3
|
+
#import "RNSScreenStack.h"
|
|
2
4
|
|
|
3
5
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
6
|
#import <React/RCTConversions.h>
|
|
7
|
+
#import <React/RCTLog.h>
|
|
5
8
|
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
6
9
|
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
7
10
|
#import <react/renderer/components/rnscreens/Props.h>
|
|
@@ -12,34 +15,82 @@ namespace react = facebook::react;
|
|
|
12
15
|
|
|
13
16
|
@implementation RNSScreenContentWrapper
|
|
14
17
|
|
|
18
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
19
|
+
|
|
15
20
|
- (void)reactSetFrame:(CGRect)frame
|
|
16
21
|
{
|
|
17
22
|
[super reactSetFrame:frame];
|
|
18
23
|
if (self.delegate != nil) {
|
|
19
|
-
[self.delegate
|
|
24
|
+
[self.delegate contentWrapper:self receivedReactFrame:frame];
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
|
|
28
|
+
#endif // !RCT_NEW_ARCH_ENABLED
|
|
29
|
+
|
|
30
|
+
- (void)notifyDelegateWithFrame:(CGRect)frame
|
|
31
|
+
{
|
|
32
|
+
[self.delegate contentWrapper:self receivedReactFrame:frame];
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
- (void)triggerDelegateUpdate
|
|
24
36
|
{
|
|
25
|
-
[self
|
|
37
|
+
[self notifyDelegateWithFrame:self.frame];
|
|
26
38
|
}
|
|
27
39
|
|
|
28
|
-
|
|
40
|
+
- (void)willMoveToWindow:(UIWindow *)newWindow
|
|
41
|
+
{
|
|
42
|
+
if (newWindow == nil) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
[self attachToAncestorScreenView];
|
|
46
|
+
}
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Searches for first `RNSScreen` instance that uses `formSheet` presentation and returns it together with accumulated
|
|
50
|
+
* heights of navigation bars discovered along tree path up.
|
|
51
|
+
*
|
|
52
|
+
* TODO: Such travelsal method could be defined as its own algorithm in separate helper methods set.
|
|
53
|
+
*/
|
|
54
|
+
- (void)attachToAncestorScreenViewStartingFrom:(nonnull RNSScreen *)screenCtrl
|
|
32
55
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
UIViewController *controller = screenCtrl;
|
|
57
|
+
float headerHeightErrata = 0.f;
|
|
58
|
+
|
|
59
|
+
do {
|
|
60
|
+
if ([controller isKindOfClass:RNSScreen.class]) {
|
|
61
|
+
RNSScreen *currentScreen = static_cast<RNSScreen *>(controller);
|
|
62
|
+
if ([currentScreen.screenView registerContentWrapper:self contentHeightErrata:headerHeightErrata]) {
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
} else if ([controller isKindOfClass:RNSNavigationController.class]) {
|
|
66
|
+
UINavigationBar *navigationBar = static_cast<RNSNavigationController *>(controller).navigationBar;
|
|
67
|
+
headerHeightErrata += navigationBar.frame.size.height * !navigationBar.isHidden;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
controller = controller.parentViewController;
|
|
71
|
+
} while (controller != nil);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (void)attachToAncestorScreenView
|
|
75
|
+
{
|
|
76
|
+
if (![self.reactSuperview isKindOfClass:RNSScreenView.class]) {
|
|
77
|
+
RCTLogError(@"Expected reactSuperview to be a RNSScreenView. Found %@", self.reactSuperview);
|
|
78
|
+
return;
|
|
36
79
|
}
|
|
80
|
+
|
|
81
|
+
RNSScreen *screen = (RNSScreen *)[self.reactSuperview reactViewController];
|
|
82
|
+
[self attachToAncestorScreenViewStartingFrom:screen];
|
|
37
83
|
}
|
|
38
84
|
|
|
39
|
-
|
|
40
|
-
|
|
85
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
86
|
+
|
|
87
|
+
#pragma mark - RCTComponentViewProtocol
|
|
88
|
+
|
|
89
|
+
- (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
|
|
90
|
+
oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics
|
|
41
91
|
{
|
|
42
|
-
[super
|
|
92
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
93
|
+
[self notifyDelegateWithFrame:RCTCGRectFromRect(layoutMetrics.frame)];
|
|
43
94
|
}
|
|
44
95
|
|
|
45
96
|
+ (react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
@@ -51,6 +102,12 @@ Class<RCTComponentViewProtocol> RNSScreenContentWrapperCls(void)
|
|
|
51
102
|
{
|
|
52
103
|
return RNSScreenContentWrapper.class;
|
|
53
104
|
}
|
|
105
|
+
|
|
106
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
107
|
+
+ (void)load
|
|
108
|
+
{
|
|
109
|
+
[super load];
|
|
110
|
+
}
|
|
54
111
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
55
112
|
|
|
56
113
|
@end
|
package/ios/RNSScreenStack.mm
CHANGED
|
@@ -552,7 +552,18 @@ RNS_IGNORE_SUPER_CALL_END
|
|
|
552
552
|
// See: https://github.com/software-mansion/react-native-screens/issues/2048
|
|
553
553
|
// For now, to mitigate the issue, we also decide to trigger its dismissal before
|
|
554
554
|
// starting the presentation chain down below in finish() callback.
|
|
555
|
-
|
|
555
|
+
if (!firstModalToBeDismissed.isBeingDismissed) {
|
|
556
|
+
[changeRootController dismissViewControllerAnimated:shouldAnimate completion:finish];
|
|
557
|
+
} else {
|
|
558
|
+
// We need to wait for its dismissal and then run our presentation code.
|
|
559
|
+
// This happens, e.g. when we have foreign modal presented on top of owned one & we dismiss foreign one and
|
|
560
|
+
// immediately present another owned one. Dismissal of the foreign one will be triggered by foreign controller.
|
|
561
|
+
[[firstModalToBeDismissed transitionCoordinator]
|
|
562
|
+
animateAlongsideTransition:nil
|
|
563
|
+
completion:^(id<UIViewControllerTransitionCoordinatorContext> _) {
|
|
564
|
+
finish();
|
|
565
|
+
}];
|
|
566
|
+
}
|
|
556
567
|
return;
|
|
557
568
|
}
|
|
558
569
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screens",
|
|
3
|
-
"version": "4.7.0-beta.
|
|
3
|
+
"version": "4.7.0-beta.2",
|
|
4
4
|
"description": "Native navigation primitives for your React Native app.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"submodules": "git submodule update --init --recursive && (cd react-navigation && yarn && yarn build && cd ../)",
|