Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rounded tiles + Bottom Sheet #337

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Bottom Sheet
wyne committed Nov 13, 2023

Verified

This commit was signed with the committer’s verified signature.
wyne Justin Wyne
commit 38731c246106721f1bc0fff3e953d47ca5a2f3a8
15 changes: 9 additions & 6 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -5,16 +5,19 @@ import { store, persistor } from './redux/store';
import { StatusBar } from 'expo-status-bar';
import { Navigation } from './src/Navigation';
import { View } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';

export default function App() {
return (
<View style={{ flex: 1, backgroundColor: '#fff' }}>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<StatusBar />
<Navigation />
</PersistGate>
</Provider>
<GestureHandlerRootView style={{ flex: 1 }}>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<StatusBar />
<Navigation />
</PersistGate>
</Provider>
</GestureHandlerRootView>
</View>
);
};
808 changes: 808 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.22.5",
"@gorhom/bottom-sheet": "^4",
"@react-native-async-storage/async-storage": "1.18.2",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-firebase/analytics": "^18.3.0",
@@ -28,6 +29,7 @@
"expo": "^49.0.6",
"expo-application": "~5.3.0",
"expo-av": "~13.4.1",
"expo-blur": "~12.4.1",
"expo-build-properties": "~0.8.3",
"expo-constants": "~14.4.2",
"expo-crypto": "~12.4.1",
@@ -37,6 +39,7 @@
"expo-image": "~1.3.2",
"expo-screen-orientation": "~6.0.5",
"expo-sensors": "~12.3.0",
"expo-sharing": "~11.5.0",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"expo-system-ui": "~2.4.0",
@@ -66,9 +69,7 @@
"react-redux": "^8.0.2",
"redux-persist": "^6.0.0",
"semver": "^7.5.4",
"typescript": "^5.1.6",
"expo-sharing": "~11.5.0",
"expo-blur": "~12.4.1"
"typescript": "^5.1.6"
},
"devDependencies": {
"@babel/core": "^7.19.3",
1 change: 0 additions & 1 deletion src/components/Rounds.tsx
Original file line number Diff line number Diff line change
@@ -79,7 +79,6 @@ const Rounds: React.FunctionComponent<Props> = ({ navigation, show }) => {
const styles = StyleSheet.create({
scoreTableContainer: {
flexDirection: 'row',
backgroundColor: 'black',
paddingBottom: 10,
}
});
2 changes: 1 addition & 1 deletion src/components/ScoreLog/RoundScoreColumn.tsx
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ const RoundScoreColumn: React.FunctionComponent<Props> = ({ round, isCurrentRoun
<TouchableWithoutFeedback onPress={onPressHandler}>
<View style={{
padding: 10,
backgroundColor: isCurrentRound ? '#111' : 'black'
// backgroundColor: isCurrentRound ? '#111' : 'black'
}}>
<Text style={{
color: isCurrentRound ? 'red' : 'yellow',
41 changes: 36 additions & 5 deletions src/screens/GameScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React, { useState } from 'react';
import { View, StyleSheet, LayoutChangeEvent } from 'react-native';
import React, { useCallback, useMemo, useRef, useState } from 'react';
import { View, StyleSheet, LayoutChangeEvent, Text } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { getContrastRatio } from 'colorsheet';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ParamListBase } from '@react-navigation/native';
import BottomSheet from '@gorhom/bottom-sheet';

import { useAppSelector } from '../../redux/hooks';
import PlayerTile from '../components/PlayerTile';
import Rounds from '../components/Rounds';
import { selectGameById } from '../../redux/GamesSlice';
import { ScrollView } from 'react-native-gesture-handler';

interface Props {
navigation: NativeStackNavigationProp<ParamListBase, string, undefined>;
@@ -77,6 +79,17 @@ const ScoreBoardScreen: React.FunctionComponent<Props> = ({ navigation }) => {
};
};

// ref
const bottomSheetRef = useRef<BottomSheet>(null);

// variables
const snapPoints = useMemo(() => [75, '60%', '100%'], []);

// callbacks
const handleSheetChanges = useCallback((index: number) => {
console.log('handleSheetChanges', index);
}, []);

return (
<SafeAreaView style={{ flex: 1 }}>
<View style={[StyleSheet.absoluteFillObject]}>
@@ -97,7 +110,21 @@ const ScoreBoardScreen: React.FunctionComponent<Props> = ({ navigation }) => {
))}
</View>

<Rounds navigation={navigation} show={!fullscreen} />
<BottomSheet
ref={bottomSheetRef}
index={0}
snapPoints={snapPoints}
onChange={handleSheetChanges}
backgroundStyle={{ backgroundColor: 'rgb(30,40,50)' }}
handleIndicatorStyle={{ backgroundColor: 'white' }}
>
<View style={styles.contentContainer}>
<Text style={{ color: 'white', fontSize: 20, padding: 20, paddingTop: 0, fontWeight: 'bold' }}>History</Text>
<ScrollView>
<Rounds navigation={navigation} show={!fullscreen} />
</ScrollView>
</View>
</BottomSheet>
</View>
</SafeAreaView>
);
@@ -111,8 +138,12 @@ const styles = StyleSheet.create({
alignContent: 'stretch',
flexDirection: 'row',
maxWidth: '100%',
backgroundColor: '#000000'
}
backgroundColor: '#000000',
paddingBottom: 75,
},
contentContainer: {
flex: 1,
},
});

export default ScoreBoardScreen;