|
|
@ -13,20 +13,24 @@ import ModePicker from '../components/ScrollingPicker'; |
|
|
|
|
|
|
|
function Home(){ |
|
|
|
const dispatch = useDispatch(); |
|
|
|
const [mode, setMode] = useState(0); |
|
|
|
const [mode, setMode] = useState('square'); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
BackHandler.addEventListener('hardwareBackPress', () => {return true}); |
|
|
|
}, []) |
|
|
|
|
|
|
|
function onPressStart(){ |
|
|
|
dispatch(squareStartPressed()); |
|
|
|
dispatch(squareStartPressed(mode)); |
|
|
|
} |
|
|
|
|
|
|
|
function onPressHighScores(){ |
|
|
|
dispatch(goToScores()); |
|
|
|
} |
|
|
|
|
|
|
|
function setGameMode(newMode) { |
|
|
|
setMode(newMode); |
|
|
|
} |
|
|
|
|
|
|
|
const now = new Date(Date.now()); |
|
|
|
|
|
|
|
return ( |
|
|
@ -51,9 +55,9 @@ function Home(){ |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
<View style={[styles.flex, styles.centeredSelf]}> |
|
|
|
<ModePicker mode={mode} modeSetter={setMode}/> |
|
|
|
<ModePicker mode={mode} modeSetter={setGameMode}/> |
|
|
|
<Text style={[styles.largeFont, styles.darkText, styles.centeredText]}> |
|
|
|
{mode === 0 ? 'Squares' : 'Addition'} |
|
|
|
{mode === 'square' ? 'Squares' : 'Addition'} |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|