fix(mobile): restore chat image previews in the v5 stack (#17361)
This commit is contained in:
1 parent
6308db4ff5
commit
393ff4c968
4 files changed
+153
-5
No files matched your search
@@ -247,6 +247,7 @@ function WorkspaceStackView(props: ViewProps) {
|
||||
const routes = [baseRoute, ...overlays.map((group) => group[0]!)];
|
||||
return (
|
||||
<NativeStackView
|
||||
presentationEnvelope
|
||||
{...props}
|
||||
state={{ ...props.state, routes, index: routes.length - 1, preloadedRoutes: [] }}
|
||||
descriptors={{
|
||||
|
||||
@@ -279,6 +279,7 @@ export function V5StackView(props: V5StackViewProps) {
|
||||
);
|
||||
return (
|
||||
<NativeStackView
|
||||
presentationEnvelope
|
||||
{...props}
|
||||
descriptors={descriptors}
|
||||
state={{ ...props.state, routes, index: routes.length - 1, preloadedRoutes: [] }}
|
||||
|
||||
@@ -1,8 +1,39 @@
|
||||
diff --git a/lib/module/views/NativeStackView.native.js b/lib/module/views/NativeStackView.native.js
|
||||
index c342e90bffde9ad5044b6167bdde2e19be219270..5d3e4407aa1bb68b873cf164adf5a9f0b487bb0b 100644
|
||||
index c342e90bffde9ad5044b6167bdde2e19be219270..4a045490f0650b4a0c821b3e799cf3d18531417f 100644
|
||||
--- a/lib/module/views/NativeStackView.native.js
|
||||
+++ b/lib/module/views/NativeStackView.native.js
|
||||
@@ -370,6 +370,17 @@ export function NativeStackView({
|
||||
@@ -17,8 +17,12 @@ const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
|
||||
function isFabric() {
|
||||
return 'nativeFabricUIManager' in global;
|
||||
}
|
||||
+function SceneNavigationProvider({ presentationEnvelope, ...props }) {
|
||||
+ return presentationEnvelope ? props.children : /*#__PURE__*/_jsx(NavigationProvider, props);
|
||||
+}
|
||||
const useNativeDriver = Platform.OS !== 'web';
|
||||
const SceneView = ({
|
||||
+ presentationEnvelope,
|
||||
index,
|
||||
focused,
|
||||
shouldFreeze,
|
||||
@@ -231,7 +235,8 @@ const SceneView = ({
|
||||
}
|
||||
}
|
||||
});
|
||||
- return /*#__PURE__*/_jsx(NavigationProvider, {
|
||||
+ return /*#__PURE__*/_jsx(SceneNavigationProvider, {
|
||||
+ presentationEnvelope,
|
||||
route: route,
|
||||
navigation: navigation,
|
||||
children: /*#__PURE__*/_jsx(ScreenStackItem, {
|
||||
@@ -353,6 +358,7 @@ const SceneView = ({
|
||||
});
|
||||
};
|
||||
export function NativeStackView({
|
||||
+ presentationEnvelope,
|
||||
state,
|
||||
navigation,
|
||||
descriptors,
|
||||
@@ -370,6 +376,17 @@ export function NativeStackView({
|
||||
return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
|
||||
children: /*#__PURE__*/_jsx(ScreenStack, {
|
||||
style: styles.container,
|
||||
@@ -20,6 +51,14 @@ index c342e90bffde9ad5044b6167bdde2e19be219270..5d3e4407aa1bb68b873cf164adf5a9f0
|
||||
children: state.routes.concat(state.preloadedRoutes).map((route, index) => {
|
||||
const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];
|
||||
const isFocused = state.index === index;
|
||||
@@ -386,6 +403,7 @@ export function NativeStackView({
|
||||
// due to component being unmounted. To avoid this, we don't freeze the previous screen there
|
||||
const shouldFreeze = isFabric() ? !isPreloaded && !isFocused && !isBelowFocused && !isModalOnIos : !isPreloaded && !isFocused && !isModalOnIos;
|
||||
return /*#__PURE__*/_jsx(SceneView, {
|
||||
+ presentationEnvelope,
|
||||
index: index,
|
||||
focused: isFocused,
|
||||
shouldFreeze: shouldFreeze,
|
||||
diff --git a/lib/module/views/useHeaderConfigProps.js b/lib/module/views/useHeaderConfigProps.js
|
||||
index 9c21aa48cb580704aa17e59d9cdadcc612a1e4ff..a1b3a38368c5ef2257570f382e87df5d6f55b11e 100644
|
||||
--- a/lib/module/views/useHeaderConfigProps.js
|
||||
@@ -189,3 +228,110 @@ index 3f3fff405048b3c2250afbe99dd7f35cecb9a6d5..bb062b898cfa77f8c02f951dc9d81b51
|
||||
>
|
||||
{item.element}
|
||||
</ScreenStackHeaderRightView>
|
||||
diff --git a/lib/typescript/src/views/NativeStackView.native.d.ts b/lib/typescript/src/views/NativeStackView.native.d.ts
|
||||
index c0d37db3b4a2a4e9340c76333821f44a87cd624b..eb3db8f511799b335a17edea31a2acd17627f909 100644
|
||||
--- a/lib/typescript/src/views/NativeStackView.native.d.ts
|
||||
+++ b/lib/typescript/src/views/NativeStackView.native.d.ts
|
||||
@@ -1,11 +1,12 @@
|
||||
import { type ParamListBase, type RouteProp, type StackNavigationState } from '@react-navigation/native';
|
||||
import type { NativeStackDescriptor, NativeStackDescriptorMap, NativeStackNavigationHelpers } from '../types.js';
|
||||
type Props = {
|
||||
+ presentationEnvelope?: boolean;
|
||||
state: StackNavigationState<ParamListBase>;
|
||||
navigation: NativeStackNavigationHelpers;
|
||||
descriptors: NativeStackDescriptorMap;
|
||||
describe: (route: RouteProp<ParamListBase>, placeholder: boolean) => NativeStackDescriptor;
|
||||
};
|
||||
-export declare function NativeStackView({ state, navigation, descriptors, describe, }: Props): import("react/jsx-runtime").JSX.Element;
|
||||
+export declare function NativeStackView({ presentationEnvelope, state, navigation, descriptors, describe, }: Props): import("react/jsx-runtime").JSX.Element;
|
||||
export {};
|
||||
//# sourceMappingURL=NativeStackView.native.d.ts.map
|
||||
\ No newline at end of file
|
||||
diff --git a/src/views/NativeStackView.native.tsx b/src/views/NativeStackView.native.tsx
|
||||
index 416cd90057cea362371a4308dd9985b086c5ccaa..7188a3daf0af2004303b21f89d3c0c7073517ef8 100644
|
||||
--- a/src/views/NativeStackView.native.tsx
|
||||
+++ b/src/views/NativeStackView.native.tsx
|
||||
@@ -51,7 +51,14 @@ function isFabric() {
|
||||
return 'nativeFabricUIManager' in global;
|
||||
}
|
||||
|
||||
+// A presentation envelope contains descriptors from its owning navigator.
|
||||
+// Its synthetic route must not override those descriptors' focus state.
|
||||
+function SceneNavigationProvider({ presentationEnvelope, ...props }: React.ComponentProps<typeof NavigationProvider> & { presentationEnvelope?: boolean }) {
|
||||
+ return presentationEnvelope ? props.children : <NavigationProvider {...props} />;
|
||||
+}
|
||||
+
|
||||
type SceneViewProps = {
|
||||
+ presentationEnvelope?: boolean;
|
||||
index: number;
|
||||
focused: boolean;
|
||||
shouldFreeze: boolean;
|
||||
@@ -74,6 +81,7 @@ type SceneViewProps = {
|
||||
const useNativeDriver = Platform.OS !== 'web';
|
||||
|
||||
const SceneView = ({
|
||||
+ presentationEnvelope,
|
||||
index,
|
||||
focused,
|
||||
shouldFreeze,
|
||||
@@ -356,7 +364,7 @@ const SceneView = ({
|
||||
);
|
||||
|
||||
return (
|
||||
- <NavigationProvider route={route} navigation={navigation}>
|
||||
+ <SceneNavigationProvider presentationEnvelope={presentationEnvelope} route={route} navigation={navigation}>
|
||||
<ScreenStackItem
|
||||
screenId={route.key}
|
||||
activityState={isPreloaded ? 0 : 2}
|
||||
@@ -493,11 +501,12 @@ const SceneView = ({
|
||||
</HeaderHeightContext.Provider>
|
||||
</AnimatedHeaderHeightContext.Provider>
|
||||
</ScreenStackItem>
|
||||
- </NavigationProvider>
|
||||
+ </SceneNavigationProvider>
|
||||
);
|
||||
};
|
||||
|
||||
type Props = {
|
||||
+ presentationEnvelope?: boolean;
|
||||
state: StackNavigationState<ParamListBase>;
|
||||
navigation: NativeStackNavigationHelpers;
|
||||
descriptors: NativeStackDescriptorMap;
|
||||
@@ -508,6 +517,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export function NativeStackView({
|
||||
+ presentationEnvelope,
|
||||
state,
|
||||
navigation,
|
||||
descriptors,
|
||||
@@ -555,6 +565,7 @@ export function NativeStackView({
|
||||
|
||||
return (
|
||||
<SceneView
|
||||
+ presentationEnvelope={presentationEnvelope}
|
||||
key={route.key}
|
||||
index={index}
|
||||
focused={isFocused}
|
||||
diff --git a/lib/typescript/src/views/NativeStackView.d.ts b/lib/typescript/src/views/NativeStackView.d.ts
|
||||
--- a/lib/typescript/src/views/NativeStackView.d.ts
|
||||
+++ b/lib/typescript/src/views/NativeStackView.d.ts
|
||||
@@ -1,6 +1,7 @@
|
||||
import { type ParamListBase, type RouteProp, type StackNavigationState } from '@react-navigation/native';
|
||||
import type { NativeStackDescriptor, NativeStackDescriptorMap, NativeStackNavigationHelpers } from '../types.js';
|
||||
type Props = {
|
||||
+ presentationEnvelope?: boolean;
|
||||
state: StackNavigationState<ParamListBase>;
|
||||
navigation: NativeStackNavigationHelpers;
|
||||
descriptors: NativeStackDescriptorMap;
|
||||
diff --git a/src/views/NativeStackView.tsx b/src/views/NativeStackView.tsx
|
||||
--- a/src/views/NativeStackView.tsx
|
||||
+++ b/src/views/NativeStackView.tsx
|
||||
@@ -24,6 +24,7 @@
|
||||
import { AnimatedHeaderHeightContext } from '../utils/useAnimatedHeaderHeight';
|
||||
|
||||
type Props = {
|
||||
+ presentationEnvelope?: boolean;
|
||||
state: StackNavigationState<ParamListBase>;
|
||||
// This is used for the native implementation of the stack.
|
||||
navigation: NativeStackNavigationHelpers;
|
||||
Generated
+3
-3
@@ -139,7 +139,7 @@ patchedDependencies:
|
||||
'@pierre/[email protected]': b33a575eb1382270ed0df956307e4b6ffe4b8e4349cefeb43e14f648c0fdc3b0
|
||||
'@react-native-ai/[email protected]': 2d09870c2848d185cb05b53ed823a46e12dba519324d8dd8e584e28731990f9d
|
||||
'@react-native-menu/[email protected]': a4866ecfcd44f318043de839d20110c17e14909004900f002ffe12050376f2ba
|
||||
'@react-navigation/[email protected]': e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552
|
||||
'@react-navigation/[email protected]': 3a53ec9b92f5db5f083f3ada585da75d62a13c82250c6ae47d92be91a828ad87
|
||||
[email protected]: bea1b6c0c0b23157fd5f439a1d7feff430f28ac1621ba135d8a13eeec60ccacd
|
||||
[email protected]: cfff57561b0ee59b5addb3b2e6c6f20906e967507a530ab67e8db8108e520ba4
|
||||
[email protected]: a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f
|
||||
@@ -325,7 +325,7 @@ importers:
|
||||
version: 7.3.4([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
'@react-navigation/native-stack':
|
||||
specifier: 7.17.6
|
||||
version: 7.17.6(patch_hash=e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552)(141a742cd91f55378cde709a48a3af06)
|
||||
version: 7.17.6(patch_hash=3a53ec9b92f5db5f083f3ada585da75d62a13c82250c6ae47d92be91a828ad87)(141a742cd91f55378cde709a48a3af06)
|
||||
'@shikijs/core':
|
||||
specifier: 4.2.0
|
||||
version: 4.2.0
|
||||
@@ -15420,7 +15420,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@react-native-masked-view/masked-view': 0.3.2([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
|
||||
'@react-navigation/[email protected](patch_hash=e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552)(141a742cd91f55378cde709a48a3af06)':
|
||||
'@react-navigation/[email protected](patch_hash=3a53ec9b92f5db5f083f3ada585da75d62a13c82250c6ae47d92be91a828ad87)(141a742cd91f55378cde709a48a3af06)':
|
||||
dependencies:
|
||||
'@react-navigation/elements': 2.9.26(83de68753219ecf7f3321e065bd378be)
|
||||
'@react-navigation/native': 7.3.4([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
|
||||
Reference in new issue
Block a user