diff --git a/ios/RNSScreen.h b/ios/RNSScreen.h index accc78a2c1..9946854d87 100644 --- a/ios/RNSScreen.h +++ b/ios/RNSScreen.h @@ -131,6 +131,12 @@ namespace react = facebook::react; @property (nonatomic, readonly) BOOL hasHeaderConfig; @property (nonatomic, readonly, getter=isMarkedForUnmountInCurrentTransaction) BOOL markedForUnmountInCurrentTransaction; + +/** + * Whether the snapshot for the transition made for JS-popped views should be taken after view updates or not. + * *This property was introduced for the sake of integration with reanimated.* + */ +@property (nonatomic) BOOL snapshotAfterUpdates; #else @property (nonatomic, copy) RCTDirectEventBlock onAppear; @property (nonatomic, copy) RCTDirectEventBlock onDisappear; diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index a432b151a8..ea549641ca 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -99,6 +99,7 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { static const auto defaultProps = std::make_shared(); + _snapshotAfterUpdates = NO; _props = defaultProps; _reactSubviews = [NSMutableArray new]; _contentWrapperBox = {}; @@ -2162,7 +2163,8 @@ - (void)setViewToSnapshot UIView *superView = self.view.superview; // if we dismissed the view natively, it will already be detached from view hierarchy if (self.view.window != nil) { - UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:NO]; + auto afterUpdates = self.screenView.snapshotAfterUpdates; + UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:afterUpdates]; snapshot.frame = self.view.frame; [self.view removeFromSuperview]; self.view = snapshot;