@react-navigation/native-stack 7.1.3 → 7.1.5
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/lib/commonjs/views/NativeStackView.js +2 -3
- package/lib/commonjs/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/views/NativeStackView.native.js +97 -96
- package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
- package/lib/module/views/NativeStackView.js +2 -3
- package/lib/module/views/NativeStackView.js.map +1 -1
- package/lib/module/views/NativeStackView.native.js +97 -96
- package/lib/module/views/NativeStackView.native.js.map +1 -1
- package/lib/typescript/commonjs/src/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/typescript/module/src/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/module/src/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/views/NativeStackView.native.tsx +123 -119
- package/src/views/NativeStackView.tsx +2 -4
|
@@ -68,6 +68,8 @@ type SceneViewProps = {
|
|
|
68
68
|
onSheetDetentChanged: ScreenProps['onSheetDetentChanged'];
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
const useNativeDriver = Platform.OS !== 'web';
|
|
72
|
+
|
|
71
73
|
const SceneView = ({
|
|
72
74
|
index,
|
|
73
75
|
focused,
|
|
@@ -273,123 +275,125 @@ const SceneView = ({
|
|
|
273
275
|
});
|
|
274
276
|
|
|
275
277
|
return (
|
|
276
|
-
<
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
{
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
278
|
+
<NavigationContext.Provider value={navigation}>
|
|
279
|
+
<NavigationRouteContext.Provider value={route}>
|
|
280
|
+
<ScreenStackItem
|
|
281
|
+
key={route.key}
|
|
282
|
+
screenId={route.key}
|
|
283
|
+
activityState={isPreloaded ? 0 : 2}
|
|
284
|
+
style={StyleSheet.absoluteFill}
|
|
285
|
+
accessibilityElementsHidden={!focused}
|
|
286
|
+
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
|
|
287
|
+
customAnimationOnSwipe={animationMatchesGesture}
|
|
288
|
+
fullScreenSwipeEnabled={fullScreenGestureEnabled}
|
|
289
|
+
fullScreenSwipeShadowEnabled={fullScreenGestureShadowEnabled}
|
|
290
|
+
freezeOnBlur={freezeOnBlur}
|
|
291
|
+
gestureEnabled={
|
|
292
|
+
Platform.OS === 'android'
|
|
293
|
+
? // This prop enables handling of system back gestures on Android
|
|
294
|
+
// Since we handle them in JS side, we disable this
|
|
295
|
+
false
|
|
296
|
+
: gestureEnabled
|
|
297
|
+
}
|
|
298
|
+
homeIndicatorHidden={autoHideHomeIndicator}
|
|
299
|
+
hideKeyboardOnSwipe={keyboardHandlingEnabled}
|
|
300
|
+
navigationBarColor={navigationBarColor}
|
|
301
|
+
navigationBarTranslucent={navigationBarTranslucent}
|
|
302
|
+
navigationBarHidden={navigationBarHidden}
|
|
303
|
+
replaceAnimation={animationTypeForReplace}
|
|
304
|
+
stackPresentation={presentation === 'card' ? 'push' : presentation}
|
|
305
|
+
stackAnimation={animation}
|
|
306
|
+
screenOrientation={orientation}
|
|
307
|
+
sheetAllowedDetents={sheetAllowedDetents}
|
|
308
|
+
sheetLargestUndimmedDetentIndex={sheetLargestUndimmedDetentIndex}
|
|
309
|
+
sheetGrabberVisible={sheetGrabberVisible}
|
|
310
|
+
sheetInitialDetentIndex={sheetInitialDetentIndex}
|
|
311
|
+
sheetCornerRadius={sheetCornerRadius}
|
|
312
|
+
sheetElevation={sheetElevation}
|
|
313
|
+
sheetExpandsWhenScrolledToEdge={sheetExpandsWhenScrolledToEdge}
|
|
314
|
+
statusBarAnimation={statusBarAnimation}
|
|
315
|
+
statusBarHidden={statusBarHidden}
|
|
316
|
+
statusBarStyle={statusBarStyle}
|
|
317
|
+
statusBarColor={statusBarBackgroundColor}
|
|
318
|
+
statusBarTranslucent={statusBarTranslucent}
|
|
319
|
+
swipeDirection={gestureDirectionOverride}
|
|
320
|
+
transitionDuration={animationDuration}
|
|
321
|
+
onWillAppear={onWillAppear}
|
|
322
|
+
onWillDisappear={onWillDisappear}
|
|
323
|
+
onAppear={onAppear}
|
|
324
|
+
onDisappear={onDisappear}
|
|
325
|
+
onDismissed={onDismissed}
|
|
326
|
+
onGestureCancel={onGestureCancel}
|
|
327
|
+
onSheetDetentChanged={onSheetDetentChanged}
|
|
328
|
+
gestureResponseDistance={gestureResponseDistance}
|
|
329
|
+
nativeBackButtonDismissalEnabled={false} // on Android
|
|
330
|
+
onHeaderBackButtonClicked={onHeaderBackButtonClicked}
|
|
331
|
+
preventNativeDismiss={isRemovePrevented} // on iOS
|
|
332
|
+
onNativeDismissCancelled={onNativeDismissCancelled}
|
|
333
|
+
// Unfortunately, because of the bug that exists on Fabric, where native event drivers
|
|
334
|
+
// for Animated objects are being created after the first notifications about the header height
|
|
335
|
+
// from the native side, `onHeaderHeightChange` event does not notify
|
|
336
|
+
// `animatedHeaderHeight` about initial values on appearing screens at the moment.
|
|
337
|
+
onHeaderHeightChange={Animated.event(
|
|
338
|
+
[
|
|
339
|
+
{
|
|
340
|
+
nativeEvent: {
|
|
341
|
+
headerHeight: rawAnimatedHeaderHeight,
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
{
|
|
346
|
+
useNativeDriver,
|
|
347
|
+
listener: (e) => {
|
|
348
|
+
if (
|
|
349
|
+
Platform.OS === 'android' &&
|
|
350
|
+
(options.headerBackground != null ||
|
|
351
|
+
options.headerTransparent)
|
|
352
|
+
) {
|
|
353
|
+
// FIXME: On Android, we get 0 if the header is translucent
|
|
354
|
+
// So we set a default height in that case
|
|
355
|
+
setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (
|
|
360
|
+
e.nativeEvent &&
|
|
361
|
+
typeof e.nativeEvent === 'object' &&
|
|
362
|
+
'headerHeight' in e.nativeEvent &&
|
|
363
|
+
typeof e.nativeEvent.headerHeight === 'number'
|
|
364
|
+
) {
|
|
365
|
+
const headerHeight =
|
|
366
|
+
e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
|
|
367
|
+
|
|
368
|
+
// Only debounce if header has large title or search bar
|
|
369
|
+
// As it's the only case where the header height can change frequently
|
|
370
|
+
const doesHeaderAnimate =
|
|
371
|
+
Platform.OS === 'ios' &&
|
|
372
|
+
(options.headerLargeTitle ||
|
|
373
|
+
options.headerSearchBarOptions);
|
|
374
|
+
|
|
375
|
+
if (doesHeaderAnimate) {
|
|
376
|
+
setHeaderHeightDebounced(headerHeight);
|
|
377
|
+
} else {
|
|
378
|
+
setHeaderHeight(headerHeight);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
374
382
|
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
// Otherwise invalid props may not be caught by TypeScript
|
|
390
|
-
>
|
|
391
|
-
<NavigationContext.Provider value={navigation}>
|
|
392
|
-
<NavigationRouteContext.Provider value={route}>
|
|
383
|
+
)}
|
|
384
|
+
contentStyle={[
|
|
385
|
+
presentation !== 'transparentModal' &&
|
|
386
|
+
presentation !== 'containedTransparentModal' && {
|
|
387
|
+
backgroundColor: colors.background,
|
|
388
|
+
},
|
|
389
|
+
contentStyle,
|
|
390
|
+
]}
|
|
391
|
+
headerConfig={headerConfig}
|
|
392
|
+
unstable_sheetFooter={unstable_sheetFooter}
|
|
393
|
+
// When ts-expect-error is added, it affects all the props below it
|
|
394
|
+
// So we keep any props that need it at the end
|
|
395
|
+
// Otherwise invalid props may not be caught by TypeScript
|
|
396
|
+
>
|
|
393
397
|
<AnimatedHeaderHeightContext.Provider value={animatedHeaderHeight}>
|
|
394
398
|
<HeaderHeightContext.Provider
|
|
395
399
|
value={
|
|
@@ -441,9 +445,9 @@ const SceneView = ({
|
|
|
441
445
|
</HeaderShownContext.Provider>
|
|
442
446
|
</HeaderHeightContext.Provider>
|
|
443
447
|
</AnimatedHeaderHeightContext.Provider>
|
|
444
|
-
</
|
|
445
|
-
</
|
|
446
|
-
</
|
|
448
|
+
</ScreenStackItem>
|
|
449
|
+
</NavigationRouteContext.Provider>
|
|
450
|
+
</NavigationContext.Provider>
|
|
447
451
|
);
|
|
448
452
|
};
|
|
449
453
|
|
|
@@ -135,10 +135,8 @@ export function NativeStackView({ state, descriptors, describe }: Props) {
|
|
|
135
135
|
<Image
|
|
136
136
|
source={headerBackImageSource}
|
|
137
137
|
resizeMode="contain"
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{ tintColor },
|
|
141
|
-
]}
|
|
138
|
+
tintColor={tintColor}
|
|
139
|
+
style={styles.backImage}
|
|
142
140
|
/>
|
|
143
141
|
)
|
|
144
142
|
: undefined
|