Skip to content

Commit

Permalink
Revert "Add layout=narrow initial param to the ModalStackNavigator"
Browse files Browse the repository at this point in the history
  • Loading branch information
marcochavezf authored Jan 16, 2024
1 parent 8e2fb67 commit 4abf30b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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,
};
}
}
1 change: 0 additions & 1 deletion src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx
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

0 comments on commit 4abf30b

Please sign in to comment.