From bca748e559ebad8846433f5cc6cfd1dcca83d84f Mon Sep 17 00:00:00 2001 From: Justin Wyne <1986068+wyne@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:06:39 -0800 Subject: [PATCH] SafeAreaView for landscape game --- .../PlayerTiles/AdditionTile/Helpers.ts | 6 +++++- src/components/Rounds.tsx | 10 ++++------ src/screens/GameScreen.tsx | 17 +++++++++-------- src/screens/ShareScreen.tsx | 1 + 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/PlayerTiles/AdditionTile/Helpers.ts b/src/components/PlayerTiles/AdditionTile/Helpers.ts index 7f819257..fd0a7214 100644 --- a/src/components/PlayerTiles/AdditionTile/Helpers.ts +++ b/src/components/PlayerTiles/AdditionTile/Helpers.ts @@ -36,9 +36,13 @@ export const scoreMathOpacity = 0.75; * @returns The calculated font size. */ export const calculateFontSize = (containerWidth: number) => { + return baseScoreFontSize * widthFactor(containerWidth); +}; + +export const widthFactor = (containerWidth: number) => { let widthFactor: number = containerWidth / 200; if (Number.isNaN(widthFactor)) { widthFactor = 1; } - return baseScoreFontSize * widthFactor; + return widthFactor; }; /** diff --git a/src/components/Rounds.tsx b/src/components/Rounds.tsx index 64d9b393..b3b6ee01 100644 --- a/src/components/Rounds.tsx +++ b/src/components/Rounds.tsx @@ -55,16 +55,14 @@ const Rounds: React.FunctionComponent = ({ navigation, show }) => { const roundsIterator = [...Array(roundTotal + 1).keys()]; return ( - + + ref={roundsScrollViewEl}> {roundsIterator.map((item, round) => ( - onLayoutHandler(e, round)}> + onLayoutHandler(e, round)}> = ({ navigation, show }) => { ))} - + ); }; diff --git a/src/screens/GameScreen.tsx b/src/screens/GameScreen.tsx index 7beb767e..d1f943dc 100644 --- a/src/screens/GameScreen.tsx +++ b/src/screens/GameScreen.tsx @@ -98,7 +98,7 @@ const ScoreBoardScreen: React.FunctionComponent = ({ navigation }) => { const bottomSheetRef = useRef(null); // variables - const snapPoints = useMemo(() => [75, '60%', '100%'], []); + const snapPoints = useMemo(() => [73, '60%', '100%'], []); // callbacks const handleSheetChanges = useCallback((index: number) => { @@ -110,9 +110,9 @@ const ScoreBoardScreen: React.FunctionComponent = ({ navigation }) => { }, []); return ( - + - + {playerIds.map((id, index) => ( width != null && height != null && rows != 0 && cols != 0 && = ({ navigation }) => { index={index} /> ))} - + = ({ navigation }) => { handleIndicatorStyle={{ backgroundColor: 'white' }} > - + + handleSnapPress(1)}> {currentGame.title} @@ -148,14 +149,14 @@ const ScoreBoardScreen: React.FunctionComponent = ({ navigation }) => { - + Tap on a column to set the current round. - + - + ); }; diff --git a/src/screens/ShareScreen.tsx b/src/screens/ShareScreen.tsx index 7ff66326..694b7477 100644 --- a/src/screens/ShareScreen.tsx +++ b/src/screens/ShareScreen.tsx @@ -75,6 +75,7 @@ const ShareScreen: React.FunctionComponent = ({ navigation }) => { borderStyle: 'solid', }}>