Skip to content

Commit

Permalink
Merge pull request #25923 from software-mansion-labs/ts-migration/get…
Browse files Browse the repository at this point in the history
…-navigation-modal-card-styles

[No QA] [TS migration] Migrate 'getNavigationModalCardStyles' style to TypeScript
  • Loading branch information
MariaHCD authored Aug 25, 2023
2 parents 0acef6d + 6b1a41e commit 74918db
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import variables from '../variables';
import GetNavigationModalCardStyles from './types';

export default ({isSmallScreenWidth}) => ({
const getBaseNavigationModalCardStyles: GetNavigationModalCardStyles = ({isSmallScreenWidth}) => ({
position: 'absolute',
top: 0,
right: 0,
width: isSmallScreenWidth ? '100%' : variables.sideBarWidth,
backgroundColor: 'transparent',
height: '100%',
});

export default getBaseNavigationModalCardStyles;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import getBaseNavigationModalCardStyles from './getBaseNavigationModalCardStyles';
import GetNavigationModalCardStyles from './types';

export default ({isSmallScreenWidth}) => ({
const getNavigationModalCardStyles: GetNavigationModalCardStyles = ({isSmallScreenWidth}) => ({
...getBaseNavigationModalCardStyles({isSmallScreenWidth}),

// position: fixed is set instead of position absolute to workaround Safari known issues of updating heights in DOM.
Expand All @@ -10,3 +11,5 @@ export default ({isSmallScreenWidth}) => ({
// https://github.com/Expensify/App/issues/20709
position: 'fixed',
});

export default getNavigationModalCardStyles;
9 changes: 9 additions & 0 deletions src/styles/getNavigationModalCardStyles/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CSSProperties} from 'react';
import {ViewStyle} from 'react-native';
import {Merge} from 'type-fest';

type GetNavigationModalCardStylesParams = {isSmallScreenWidth: number};

type GetNavigationModalCardStyles = (params: GetNavigationModalCardStylesParams) => Merge<ViewStyle, Pick<CSSProperties, 'position'>>;

export default GetNavigationModalCardStyles;

0 comments on commit 74918db

Please sign in to comment.