|
@ -1,12 +1,12 @@ |
|
|
import React, { useEffect, useState } from "react"; |
|
|
import React, { useEffect, useState } from "react"; |
|
|
import { BackHandler, SafeAreaView, Text, TouchableOpacity, View } from "react-native"; |
|
|
import { BackHandler, SafeAreaView, Text, TextInput, TouchableOpacity, View } from "react-native"; |
|
|
import { styles } from './styles/AppStyles'; |
|
|
import { styles } from './styles/AppStyles'; |
|
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'; |
|
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'; |
|
|
import Icons from '../themes/Icons'; |
|
|
import Icons from '../themes/Icons'; |
|
|
import Colors from "../themes/Colors"; |
|
|
import Colors from "../themes/Colors"; |
|
|
import Metrics from "../themes/Metrics"; |
|
|
import Metrics from "../themes/Metrics"; |
|
|
import Slider from "../components/Slider"; |
|
|
import Slider from "../components/Slider"; |
|
|
import { useDispatch } from "react-redux"; |
|
|
import { useDispatch, useSelector } from "react-redux"; |
|
|
import {squareStartPressed} from '../redux/actions/UserActions'; |
|
|
import {squareStartPressed} from '../redux/actions/UserActions'; |
|
|
import { goToScores } from "../redux/actions/SystemActions"; |
|
|
import { goToScores } from "../redux/actions/SystemActions"; |
|
|
import ModePicker from '../components/ScrollingPicker'; |
|
|
import ModePicker from '../components/ScrollingPicker'; |
|
@ -14,13 +14,15 @@ import ModePicker from '../components/ScrollingPicker'; |
|
|
function Home(){ |
|
|
function Home(){ |
|
|
const dispatch = useDispatch(); |
|
|
const dispatch = useDispatch(); |
|
|
const [mode, setMode] = useState('square'); |
|
|
const [mode, setMode] = useState('square'); |
|
|
|
|
|
const userRedux = useSelector((state) => state.user); |
|
|
|
|
|
const [username, setUsername] = useState(() => {return userRedux.username}) |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
BackHandler.addEventListener('hardwareBackPress', () => {return true}); |
|
|
BackHandler.addEventListener('hardwareBackPress', () => {return true}); |
|
|
}, []) |
|
|
}, []) |
|
|
|
|
|
|
|
|
function onPressStart(){ |
|
|
function onPressStart(){ |
|
|
dispatch(squareStartPressed(mode)); |
|
|
dispatch(squareStartPressed(mode, username)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function onPressHighScores(){ |
|
|
function onPressHighScores(){ |
|
@ -76,6 +78,19 @@ function Home(){ |
|
|
</TouchableOpacity> |
|
|
</TouchableOpacity> |
|
|
</Slider> |
|
|
</Slider> |
|
|
</View> |
|
|
</View> |
|
|
|
|
|
<View style={[styles.flexRow, styles.centeredJustify, styles.centeredItems]}> |
|
|
|
|
|
<MaterialIcon |
|
|
|
|
|
name={Icons.squareIcons.edit} |
|
|
|
|
|
color={Colors.material.grey400} |
|
|
|
|
|
size={Metrics.icons.inputIcon} |
|
|
|
|
|
/> |
|
|
|
|
|
<TextInput |
|
|
|
|
|
style={[styles.darkText, styles.headerTitleFont, styles.usernameInput]} |
|
|
|
|
|
placeholder={'username'} |
|
|
|
|
|
value={username} |
|
|
|
|
|
onChangeText={(updated) => setUsername(updated)} |
|
|
|
|
|
/> |
|
|
|
|
|
</View> |
|
|
<View style={[styles.footer, styles.centeredJustify]}> |
|
|
<View style={[styles.footer, styles.centeredJustify]}> |
|
|
<Text style={[styles.greyText, styles.tinyFont, styles.centeredText]}> |
|
|
<Text style={[styles.greyText, styles.tinyFont, styles.centeredText]}> |
|
|
0.0.1a Atonal Software Aug 9 2022 |
|
|
0.0.1a Atonal Software Aug 9 2022 |
|
|