Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Revert "Add layout=narrow initial param to the ModalStackNavigator" #34552

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/hooks/useResponsiveLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useRoute} from '@react-navigation/native';
import useWindowDimensions from './useWindowDimensions';

type RouteParams = ParamListBase & {
params: {layout?: string};
params: {isInRHP?: boolean};
};
type ResponsiveLayoutResult = {
shouldUseNarrowLayout: boolean;
Expand All @@ -16,11 +16,10 @@ export default function useResponsiveLayout(): ResponsiveLayoutResult {
try {
// eslint-disable-next-line react-hooks/rules-of-hooks
const {params} = useRoute<RouteProp<RouteParams, 'params'>>();
const isNarrowLayout = params?.layout === 'narrow' ?? false;
const shouldUseNarrowLayout = isSmallScreenWidth || isNarrowLayout;

return {shouldUseNarrowLayout};
return {shouldUseNarrowLayout: isSmallScreenWidth || (params?.isInRHP ?? false)};
} catch (error) {
return {shouldUseNarrowLayout: isSmallScreenWidth};
return {
shouldUseNarrowLayout: isSmallScreenWidth,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ function createModalStackNavigator<TStackParams extends ParamListBase>(screens:
key={name}
name={name}
getComponent={(screens as Required<Screens>)[name as Screen]}
initialParams={{layout: 'narrow'} as TStackParams[string]}
/>
))}
</ModalStackNavigator.Navigator>
Expand Down
Loading