Skip to content

Commit a1c94f3

Browse files
authored
Merge pull request #49937 from margelo/@chrispader/use-platform-stack-navigation-in-app
2 parents fd13f39 + 85c0dd7 commit a1c94f3

File tree

320 files changed

+1439
-1990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+1439
-1990
lines changed

ios/Podfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,7 @@ PODS:
17661766
- ReactCommon/turbomodule/bridging
17671767
- ReactCommon/turbomodule/core
17681768
- Yoga
1769-
- react-native-pager-view (6.5.0):
1769+
- react-native-pager-view (6.5.1):
17701770
- DoubleConversion
17711771
- glog
17721772
- hermes-engine
@@ -1779,7 +1779,7 @@ PODS:
17791779
- React-featureflags
17801780
- React-graphics
17811781
- React-ImageManager
1782-
- react-native-pager-view/common (= 6.5.0)
1782+
- react-native-pager-view/common (= 6.5.1)
17831783
- React-NativeModulesApple
17841784
- React-RCTFabric
17851785
- React-rendererdebug
@@ -1788,7 +1788,7 @@ PODS:
17881788
- ReactCommon/turbomodule/bridging
17891789
- ReactCommon/turbomodule/core
17901790
- Yoga
1791-
- react-native-pager-view/common (6.5.0):
1791+
- react-native-pager-view/common (6.5.1):
17921792
- DoubleConversion
17931793
- glog
17941794
- hermes-engine
@@ -3224,7 +3224,7 @@ SPEC CHECKSUMS:
32243224
react-native-keyboard-controller: 97bb7b48fa427c7455afdc8870c2978efd9bfa3a
32253225
react-native-launch-arguments: 5f41e0abf88a15e3c5309b8875d6fd5ac43df49d
32263226
react-native-netinfo: fb5112b1fa754975485884ae85a3fb6a684f49d5
3227-
react-native-pager-view: c64a744211a46202619a77509f802765d1659dba
3227+
react-native-pager-view: abc5ef92699233eb726442c7f452cac82f73d0cb
32283228
react-native-pdf: dd6ae39a93607a80919bef9f3499e840c693989d
32293229
react-native-performance: 3c608307be10964f8a97d3af462f37125b6d8fa5
32303230
react-native-plaid-link-sdk: f91a22b45b7c3d4cd6c47273200dc57df35068b0

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"react-native-localize": "^2.2.6",
154154
"react-native-modal": "^13.0.0",
155155
"react-native-onyx": "2.0.82",
156-
"react-native-pager-view": "6.5.0",
156+
"react-native-pager-view": "6.5.1",
157157
"react-native-pdf": "6.7.3",
158158
"react-native-performance": "^5.1.0",
159159
"react-native-permissions": "^3.10.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt
2+
index 9d08d39..146b9c2 100644
3+
--- a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt
4+
+++ b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt
5+
@@ -18,6 +18,7 @@ import com.facebook.react.uimanager.PixelUtil
6+
import com.facebook.react.uimanager.UIManagerHelper
7+
import com.facebook.react.uimanager.UIManagerModule
8+
import com.swmansion.rnscreens.events.HeaderHeightChangeEvent
9+
+import com.swmansion.rnscreens.ext.isInsideScrollViewWithRemoveClippedSubviews
10+
11+
@SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated.
12+
class Screen(
13+
@@ -310,6 +311,16 @@ class Screen(
14+
startTransitionRecursive(child.toolbar)
15+
}
16+
if (child is ViewGroup) {
17+
+ // a combination of https://github.com/software-mansion/react-native-screens/pull/2307/files and https://github.com/software-mansion/react-native-screens/pull/2383/files
18+
+ // The children are miscounted when there's a FlatList with
19+
+ // removeClippedSubviews set to true (default).
20+
+ // We add a simple view for each item in the list to make it work as expected.
21+
+ // See https://github.com/software-mansion/react-native-screens/issues/2282
22+
+ if (child.isInsideScrollViewWithRemoveClippedSubviews()) {
23+
+ for (j in 0 until child.childCount) {
24+
+ child.addView(View(context))
25+
+ }
26+
+ }
27+
startTransitionRecursive(child)
28+
}
29+
}
30+
diff --git a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt
31+
new file mode 100644
32+
index 0000000..9d9fbfd
33+
--- /dev/null
34+
+++ b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt
35+
@@ -0,0 +1,21 @@
36+
+package com.swmansion.rnscreens.ext
37+
+
38+
+import android.view.View
39+
+import android.view.ViewGroup
40+
+import com.facebook.react.views.scroll.ReactHorizontalScrollView
41+
+import com.facebook.react.views.scroll.ReactScrollView
42+
+import com.swmansion.rnscreens.ScreenStack
43+
+
44+
+internal fun View.isInsideScrollViewWithRemoveClippedSubviews(): Boolean {
45+
+ if (this is ReactHorizontalScrollView || this is ReactScrollView) {
46+
+ return false
47+
+ }
48+
+ var parentView = this.parent
49+
+ while (parentView is ViewGroup && parentView !is ScreenStack) {
50+
+ if (parentView is ReactScrollView) {
51+
+ return parentView.removeClippedSubviews
52+
+ }
53+
+ parentView = parentView.parent
54+
+ }
55+
+ return false
56+
+}
57+
\ No newline at end of file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
diff --git a/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm b/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm
2+
index abb2cf6..fb81d52 100644
3+
--- a/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm
4+
+++ b/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm
5+
@@ -5,13 +5,14 @@
6+
7+
// proportions to default transition duration
8+
static const float RNSSlideOpenTransitionDurationProportion = 1;
9+
-static const float RNSFadeOpenTransitionDurationProportion = 0.2 / 0.35;
10+
-static const float RNSSlideCloseTransitionDurationProportion = 0.25 / 0.35;
11+
-static const float RNSFadeCloseTransitionDurationProportion = 0.15 / 0.35;
12+
-static const float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.35;
13+
+static const float RNSFadeOpenTransitionDurationProportion = 0.2 / 0.5;
14+
+static const float RNSSlideCloseTransitionDurationProportion = 0.25 / 0.5;
15+
+static const float RNSFadeCloseTransitionDurationProportion = 0.15 / 0.5;
16+
+static const float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.5;
17+
// same value is used in other projects using similar approach for transistions
18+
// and it looks the most similar to the value used by Apple
19+
static constexpr float RNSShadowViewMaxAlpha = 0.1;
20+
+static const int UIViewAnimationOptionCurveDefaultTransition = 7 << 16;
21+
22+
@implementation RNSScreenStackAnimator {
23+
UINavigationControllerOperation _operation;
24+
@@ -22,7 +23,7 @@ - (instancetype)initWithOperation:(UINavigationControllerOperation)operation
25+
{
26+
if (self = [super init]) {
27+
_operation = operation;
28+
- _transitionDuration = 0.35; // default duration in seconds
29+
+ _transitionDuration = 0.5; // default duration in seconds
30+
}
31+
return self;
32+
}
33+
@@ -129,6 +130,8 @@ - (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled
34+
}
35+
36+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
37+
+ delay:0
38+
+ options:UIViewAnimationOptionCurveDefaultTransition
39+
animations:^{
40+
fromViewController.view.transform = leftTransform;
41+
toViewController.view.transform = CGAffineTransformIdentity;
42+
@@ -170,6 +173,8 @@ - (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled
43+
44+
if (!transitionContext.isInteractive) {
45+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
46+
+ delay:0
47+
+ options:UIViewAnimationOptionCurveDefaultTransition
48+
animations:animationBlock
49+
completion:completionBlock];
50+
} else {
51+
@@ -203,6 +208,8 @@ - (void)animateSlideFromLeftWithTransitionContext:(id<UIViewControllerContextTra
52+
toViewController.view.transform = rightTransform;
53+
[[transitionContext containerView] addSubview:toViewController.view];
54+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
55+
+ delay:0
56+
+ options:UIViewAnimationOptionCurveDefaultTransition
57+
animations:^{
58+
fromViewController.view.transform = leftTransform;
59+
toViewController.view.transform = CGAffineTransformIdentity;
60+
@@ -228,6 +235,8 @@ - (void)animateSlideFromLeftWithTransitionContext:(id<UIViewControllerContextTra
61+
62+
if (!transitionContext.isInteractive) {
63+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
64+
+ delay:0
65+
+ options:UIViewAnimationOptionCurveDefaultTransition
66+
animations:animationBlock
67+
completion:completionBlock];
68+
} else {
69+
@@ -251,6 +260,8 @@ - (void)animateFadeWithTransitionContext:(id<UIViewControllerContextTransitionin
70+
[[transitionContext containerView] addSubview:toViewController.view];
71+
toViewController.view.alpha = 0.0;
72+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
73+
+ delay:0
74+
+ options:UIViewAnimationOptionCurveDefaultTransition
75+
animations:^{
76+
toViewController.view.alpha = 1.0;
77+
}
78+
@@ -262,6 +273,8 @@ - (void)animateFadeWithTransitionContext:(id<UIViewControllerContextTransitionin
79+
[[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view];
80+
81+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
82+
+ delay:0
83+
+ options:UIViewAnimationOptionCurveDefaultTransition
84+
animations:^{
85+
fromViewController.view.alpha = 0.0;
86+
}
87+
@@ -284,6 +297,8 @@ - (void)animateSlideFromBottomWithTransitionContext:(id<UIViewControllerContextT
88+
toViewController.view.transform = topBottomTransform;
89+
[[transitionContext containerView] addSubview:toViewController.view];
90+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
91+
+ delay:0
92+
+ options:UIViewAnimationOptionCurveDefaultTransition
93+
animations:^{
94+
fromViewController.view.transform = CGAffineTransformIdentity;
95+
toViewController.view.transform = CGAffineTransformIdentity;
96+
@@ -309,6 +324,8 @@ - (void)animateSlideFromBottomWithTransitionContext:(id<UIViewControllerContextT
97+
98+
if (!transitionContext.isInteractive) {
99+
[UIView animateWithDuration:[self transitionDuration:transitionContext]
100+
+ delay:0
101+
+ options:UIViewAnimationOptionCurveDefaultTransition
102+
animations:animationBlock
103+
completion:completionBlock];
104+
} else {
105+
diff --git a/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts b/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts
106+
index 28d6463..a1473e1 100644
107+
--- a/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts
108+
+++ b/node_modules/react-native-screens/lib/typescript/fabric/ModalScreenNativeComponent.d.ts
109+
@@ -55,7 +55,7 @@ export interface NativeProps extends ViewProps {
110+
gestureResponseDistance?: GestureResponseDistanceType;
111+
stackPresentation?: WithDefault<StackPresentation, 'push'>;
112+
stackAnimation?: WithDefault<StackAnimation, 'default'>;
113+
- transitionDuration?: WithDefault<Int32, 350>;
114+
+ transitionDuration?: WithDefault<Int32, 500>;
115+
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
116+
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
117+
hideKeyboardOnSwipe?: boolean;
118+
diff --git a/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts b/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts
119+
index 11ed190..f676e08 100644
120+
--- a/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts
121+
+++ b/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts
122+
@@ -55,7 +55,7 @@ export interface NativeProps extends ViewProps {
123+
gestureResponseDistance?: GestureResponseDistanceType;
124+
stackPresentation?: WithDefault<StackPresentation, 'push'>;
125+
stackAnimation?: WithDefault<StackAnimation, 'default'>;
126+
- transitionDuration?: WithDefault<Int32, 350>;
127+
+ transitionDuration?: WithDefault<Int32, 500>;
128+
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
129+
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
130+
hideKeyboardOnSwipe?: boolean;
131+
diff --git a/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts b/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts
132+
index bb59c4c..d4c14ee 100644
133+
--- a/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts
134+
+++ b/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts
135+
@@ -90,7 +90,7 @@ export interface NativeProps extends ViewProps {
136+
gestureResponseDistance?: GestureResponseDistanceType;
137+
stackPresentation?: WithDefault<StackPresentation, 'push'>;
138+
stackAnimation?: WithDefault<StackAnimation, 'default'>;
139+
- transitionDuration?: WithDefault<Int32, 350>;
140+
+ transitionDuration?: WithDefault<Int32, 500>;
141+
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
142+
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
143+
hideKeyboardOnSwipe?: boolean;
144+
diff --git a/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts b/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts
145+
index 4e39336..ab0b313 100644
146+
--- a/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts
147+
+++ b/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts
148+
@@ -92,7 +92,7 @@ export interface NativeProps extends ViewProps {
149+
gestureResponseDistance?: GestureResponseDistanceType;
150+
stackPresentation?: WithDefault<StackPresentation, 'push'>;
151+
stackAnimation?: WithDefault<StackAnimation, 'default'>;
152+
- transitionDuration?: WithDefault<Int32, 350>;
153+
+ transitionDuration?: WithDefault<Int32, 500>;
154+
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;
155+
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;
156+
hideKeyboardOnSwipe?: boolean;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/node_modules/react-native-screens/ios/RNSScreenStack.mm b/node_modules/react-native-screens/ios/RNSScreenStack.mm
2+
index ea27b03..8f1d005 100644
3+
--- a/node_modules/react-native-screens/ios/RNSScreenStack.mm
4+
+++ b/node_modules/react-native-screens/ios/RNSScreenStack.mm
5+
@@ -1121,16 +1121,7 @@ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompone
6+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
7+
{
8+
RNSScreenView *screenChildComponent = (RNSScreenView *)childComponentView;
9+
-
10+
- // We should only do a snapshot of a screen that is on the top.
11+
- // We also check `_presentedModals` since if you push 2 modals, second one is not a "child" of _controller.
12+
- // Also, when dissmised with a gesture, the screen already is not under the window, so we don't need to apply
13+
- // snapshot.
14+
- if (screenChildComponent.window != nil &&
15+
- ((screenChildComponent == _controller.visibleViewController.view && _presentedModals.count < 2) ||
16+
- screenChildComponent == [_presentedModals.lastObject view])) {
17+
- [screenChildComponent.controller setViewToSnapshot];
18+
- }
19+
+ [screenChildComponent.controller setViewToSnapshot];
20+
21+
RCTAssert(
22+
screenChildComponent.reactSuperview == self,

src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {PortalProvider} from '@gorhom/portal';
22
import React from 'react';
33
import {LogBox} from 'react-native';
44
import {GestureHandlerRootView} from 'react-native-gesture-handler';
5+
import {KeyboardProvider} from 'react-native-keyboard-controller';
56
import {PickerStateProvider} from 'react-native-picker-select';
67
import {SafeAreaProvider} from 'react-native-safe-area-context';
78
import '../wdyr';
@@ -14,7 +15,6 @@ import CustomStatusBarAndBackgroundContextProvider from './components/CustomStat
1415
import ErrorBoundary from './components/ErrorBoundary';
1516
import HTMLEngineProvider from './components/HTMLEngineProvider';
1617
import InitialURLContextProvider from './components/InitialURLContextProvider';
17-
import KeyboardProvider from './components/KeyboardProvider';
1818
import {LocaleContextProvider} from './components/LocaleContextProvider';
1919
import OnyxProvider from './components/OnyxProvider';
2020
import PopoverContextProvider from './components/PopoverProvider';

src/components/AttachmentModal.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ function AttachmentModal({
491491
<>
492492
<Modal
493493
type={modalType}
494-
onSubmit={submitAndClose}
495494
onClose={isOverlayModalVisible ? closeConfirmModal : closeModal}
496495
isVisible={isModalOpen}
497496
onModalShow={() => {

src/components/ConfirmModal.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ function ConfirmModal({
143143

144144
return (
145145
<Modal
146-
onSubmit={onConfirm}
147146
onClose={onCancel}
148147
onBackdropPress={onBackdropPress}
149148
isVisible={isVisible}

src/components/Modal/types.ts

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ type BaseModalProps = Partial<ModalProps> & {
3636
/** State that determines whether to display the modal or not */
3737
isVisible: boolean;
3838

39-
/** Callback method fired when the user requests to submit the modal content. */
40-
onSubmit?: () => void;
41-
4239
/** Callback method fired when the modal is hidden */
4340
onModalHide?: () => void;
4441

src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type {RouteProp} from '@react-navigation/native';
21
import {useRoute} from '@react-navigation/native';
32
import lodashSortBy from 'lodash/sortBy';
43
import truncate from 'lodash/truncate';
@@ -29,6 +28,7 @@ import * as CurrencyUtils from '@libs/CurrencyUtils';
2928
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
3029
import * as IOUUtils from '@libs/IOUUtils';
3130
import Navigation from '@libs/Navigation/Navigation';
31+
import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
3232
import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types';
3333
import * as OptionsListUtils from '@libs/OptionsListUtils';
3434
import * as PolicyUtils from '@libs/PolicyUtils';
@@ -71,7 +71,7 @@ function MoneyRequestPreviewContent({
7171
const StyleUtils = useStyleUtils();
7272
const {translate} = useLocalize();
7373
const {windowWidth} = useWindowDimensions();
74-
const route = useRoute<RouteProp<TransactionDuplicateNavigatorParamList, typeof SCREENS.TRANSACTION_DUPLICATE.REVIEW>>();
74+
const route = useRoute<PlatformStackRouteProp<TransactionDuplicateNavigatorParamList, typeof SCREENS.TRANSACTION_DUPLICATE.REVIEW>>();
7575
const {shouldUseNarrowLayout} = useResponsiveLayout();
7676
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
7777
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || '-1'}`);

0 commit comments

Comments
 (0)