Skip to content

Commit

Permalink
Restore fullscreen button
Browse files Browse the repository at this point in the history
  • Loading branch information
wyne committed Nov 15, 2023
1 parent 39936b2 commit f2bda04
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/GameBottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Icon } from 'react-native-elements';
/**
* Height of the bottom sheet
*/
export const bottomSheetHeight = 90;
export const bottomSheetHeight = 80;

interface Props {
navigation: NativeStackNavigationProp<ParamListBase, string, undefined>;
Expand Down Expand Up @@ -133,7 +133,7 @@ const styles = StyleSheet.create({
fontWeight: 'bold'
},
sheetHeaderButton: {
paddingHorizontal: 20,
paddingHorizontal: 10,
fontSize: 20,
color: systemBlue,
},
Expand Down
2 changes: 2 additions & 0 deletions src/components/Headers/GameHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import analytics from '@react-native-firebase/analytics';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';

import FullscreenButton from '../Buttons/FullscreenButton';
import { roundNext, roundPrevious } from '../../../redux/GamesSlice';
import { selectGameById } from '../../../redux/GamesSlice';
import { systemBlue } from '../../constants';
Expand Down Expand Up @@ -91,6 +92,7 @@ const GameHeader: React.FunctionComponent<Props> = ({ navigation }) => {
<CustomHeader navigation={navigation}
headerLeft={<>
<MenuButton navigation={navigation} />
<FullscreenButton />
</>}
headerCenter={<>
<PrevRoundButton prevRoundHandler={prevRoundHandler} roundCurrent={roundCurrent} />
Expand Down
13 changes: 10 additions & 3 deletions src/screens/GameScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const ScoreBoardScreen: React.FunctionComponent<Props> = ({ navigation }) => {
const palette = ["01497c", "c25858", "f5c800", "275436", "dc902c", "62516a", "755647", "925561"];
const [rows, setRows] = useState<number>(0);
const [cols, setCols] = useState<number>(0);
const fullscreen = useAppSelector(state => state.settings.home_fullscreen);
const currentGame = useAppSelector(state => selectGameById(state, state.settings.currentGameId));

const [width, setWidth] = useState<number | null>(null);
Expand Down Expand Up @@ -101,7 +102,12 @@ const ScoreBoardScreen: React.FunctionComponent<Props> = ({ navigation }) => {
return (
<View style={{ flex: 1 }}>
<View style={[StyleSheet.absoluteFillObject]} onLayout={onLayout}>
<SafeAreaView edges={['left', 'right']} style={styles.contentStyle} onLayout={layoutHandler} >
<SafeAreaView edges={['left', 'right']} style={
[styles.contentStyle,
{
paddingBottom: fullscreen ? 20 : bottomSheetHeight + 2, // Add 2 to account for the border
}]
} onLayout={layoutHandler} >
{playerIds.map((id, index) => (
width != null && height != null && rows != 0 && cols != 0 &&
<PlayerTile
Expand All @@ -117,7 +123,9 @@ const ScoreBoardScreen: React.FunctionComponent<Props> = ({ navigation }) => {
/>
))}
</SafeAreaView>
<GameBottomSheet navigation={navigation} containerHeight={windowHeight} />
{!fullscreen &&
<GameBottomSheet navigation={navigation} containerHeight={windowHeight} />
}
</View>
</View>
);
Expand All @@ -132,7 +140,6 @@ const styles = StyleSheet.create({
flexDirection: 'row',
maxWidth: '100%',
backgroundColor: '#000000',
paddingBottom: bottomSheetHeight + 2, // Add 2 to account for the border
},
contentContainer: {
flex: 1,
Expand Down

0 comments on commit f2bda04

Please sign in to comment.