-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve layout for tablet screens on setup screens
- Loading branch information
1 parent
df49eb7
commit ce480e8
Showing
6 changed files
with
337 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import type { FC, PropsWithChildren } from 'react'; | ||
import { Box } from 'react-native-flex-layout'; | ||
|
||
import useOrientation, { Orientation } from '@/hooks/useOrientation'; | ||
|
||
export interface OrientationContainerProps extends PropsWithChildren { | ||
flexOnPortrait?: number; | ||
flexOnLandscape?: number; | ||
display?: 'flex' | 'none'; | ||
flexDirection?: 'row' | 'column'; | ||
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'; | ||
justifyContent?: | ||
| 'flex-start' | ||
| 'flex-end' | ||
| 'center' | ||
| 'space-between' | ||
| 'space-around' | ||
| 'space-evenly'; | ||
} | ||
|
||
const OrientationContainer: FC<OrientationContainerProps> = ({ | ||
children, | ||
flexOnLandscape = 0.5, | ||
flexOnPortrait = 1, | ||
display = 'flex', | ||
flexDirection = 'column', | ||
alignItems = 'stretch', | ||
justifyContent = 'flex-start', | ||
}) => { | ||
const { orientation } = useOrientation(); | ||
|
||
return ( | ||
<Box | ||
style={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
flexDirection: 'row', | ||
height: '100%', | ||
}} | ||
> | ||
<Box | ||
style={{ | ||
flex: | ||
orientation === Orientation.PORTRAIT | ||
? flexOnPortrait | ||
: flexOnLandscape, | ||
display, | ||
flexDirection, | ||
alignItems, | ||
justifyContent, | ||
}} | ||
> | ||
{children} | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default OrientationContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.