diff --git a/app/config/data.js b/app/config/data.js index de6887c..b22d23a 100644 --- a/app/config/data.js +++ b/app/config/data.js @@ -2099,8 +2099,8 @@ export const katakanaList = [ { "id":"k_mi", "type":"katakana", - "romaji":"ミ", - "moji":"み", + "romaji":"mi", + "moji":"ミ", "audio":"mi.mp3", "title":"mi", }, diff --git a/app/config/router.js b/app/config/router.js index d107881..c0f4f98 100644 --- a/app/config/router.js +++ b/app/config/router.js @@ -38,6 +38,14 @@ import HiraganaLearnScreen from '../screens/Learn/hiraganalearn'; import KatakanaLearnScreen from '../screens/Learn/katakanalearn'; const styles = require('../styles/style'); + +export const QuizStack = TabNavigator({ + QuizHiraganaList: QuizHiraganaListScreen, + QuizKarakanaList: QuizKatakanaListScreen +}, { + tabBarPosition: 'top', +}); + //import const StudyStack = StackNavigator({ StudyList: StudyListScreen, @@ -46,7 +54,7 @@ const StudyStack = StackNavigator({ QuizFlash: QuizFlashScreen, LearnListScreen: LearnListScreen, QuizMain: QuizMainScreen, - QuizList: QuizListScreen, + QuizList: QuizStack, LearnHiraganaModule: { screen: LearnHiraganaModule, @@ -115,12 +123,6 @@ export const AppStack = TabNavigator({ } }); -export const QuizStack = TabNavigator({ - QuizHiraganaList: QuizHiraganaListScreen, - QuizKarakanaList: QuizKatakanaListScreen -}, { - tabBarPosition: 'top', -}); export const MainStack = StackNavigator({ AppStack: { diff --git a/app/screens/Quiz/quizHiraganaList.js b/app/screens/Quiz/quizHiraganaList.js index 1b0731e..27caf14 100644 --- a/app/screens/Quiz/quizHiraganaList.js +++ b/app/screens/Quiz/quizHiraganaList.js @@ -14,7 +14,6 @@ import { import { hiraganaList } from '../../config/data'; import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; - class QuizHiraganaListScreen extends Component { static navigationOptions = { @@ -31,7 +30,7 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; constructor(props){ super(props); this.checkItems = [hiraganaList.map.length]; - // this.CheckRows = [hiraganaList.map.length]; + this.checkRows=[hiraganaList.map.length]; } render() { @@ -44,7 +43,9 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; > {this.state.checkAllText} - + Proceed > @@ -89,51 +90,77 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; if(this.checkItems[key]){ this.checkItems[key] = false; this.setState({ stsList: this.checkItems}); + this.selectedList(key) } else{ this.checkItems[key] = true; this.setState({ stsList: this.checkItems}); + this.selectedList(key) } }; checkAll(){ this.setState({statusCheckAll: !this.state.statusCheckAll}) if(this.state.statusCheckAll){ - {hiraganaList.map((item, key)=>( + hiraganaList.map((item, key)=>( this.checkItems[key] = false, - this.setState({ stsList: this.checkItems }) - ))}; + this.setState({ stsList: this.checkItems }), + this.selectedList(key) + )); this.setState({ checkAllText: "Check All" }) }else{ {hiraganaList.map((item, key)=>( this.checkItems[key] = true, - this.setState({ stsList: this.checkItems }) + this.setState({ stsList: this.checkItems }), + this.selectedList(key) ))}; this.setState({ checkAllText: "Uncheck All" }) } }; + checkRow(key){ - if(this.checkItems[key]){ - this.checkItems[key] = false, - this.setState({ statusPerRow: this.checkItems }) + if(this.checkRows[key]){ + this.checkRows[key] = false, + this.setState({ statusPerRow: this.checkRows }) for(x=0;x<5;x++){ this.checkItems[key] = false, this.setState({ stsList: this.checkItems }) - key=key-1 + this.selectedList(key) + key=key-1; } }else{ - this.checkItems[key] = true, - this.setState({ statusPerRow: this.checkItems }) + this.checkRows[key] = true, + this.setState({ statusPerRow: this.checkRows }) for(x=0;x<5;x++){ this.checkItems[key] = true, this.setState({ stsList: this.checkItems }) + this.selectedList(key) key=key-1 } } } - getActiveid(){ - this.sta - } + proceed = () => { + this.props.navigation.navigate('QuizFlash',this.state.idList); + }; + + selectedList(key){ + if(this.checkItems[key]){ + if(hiraganaList[key].id !=""){ + this.setState((previousState) => { + previousState.idList.push(hiraganaList[key].id); + return previousState; + }) + } + }else{ + if(hiraganaList[key].id !=""){ + this.setState((previousState) => { + var idIndex = previousState.idList.indexOf(hiraganaList[key].id); + previousState.idList.splice(idIndex,1); + return previousState; + }) + } + } + } } const quizStyles = require('../../styles/quizStyle'); diff --git a/app/screens/Quiz/quizKatakanaList.js b/app/screens/Quiz/quizKatakanaList.js index 8afd707..ab437bd 100644 --- a/app/screens/Quiz/quizKatakanaList.js +++ b/app/screens/Quiz/quizKatakanaList.js @@ -26,11 +26,21 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; statusCheckAll: false, stsList : false, statusPerRow: false, + idList:[], } + componentDidMount() { + const { navigation } = this.props; + this.setState({ + test: navigation.getParam('idList', null), + }); + console.log(this.state.test,"niamak") + } + constructor(props){ super(props); this.checkItems = [katakanaList.map.length]; + this.checkRows = [katakanaList.map.length]; } render() { @@ -43,7 +53,9 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; > {this.state.checkAllText} - + Proceed > @@ -88,10 +100,12 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; if(this.checkItems[key]){ this.checkItems[key] = false; this.setState({ stsList: this.checkItems }); + this.selectedList(key) } else{ this.checkItems[key] = true; this.setState({ stsList: this.checkItems }); + this.selectedList(key) } }; checkAll(){ @@ -99,36 +113,65 @@ import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox'; if(this.state.statusCheckAll){ {katakanaList.map((item, key)=>( this.checkItems[key] = false, - this.setState({ stsList: this.checkItems }) + this.setState({ stsList: this.checkItems }), + this.selectedList(key) ))}; this.setState({ checkAllText: "Check All" }) }else{ {katakanaList.map((item, key)=>( this.checkItems[key] = true, - this.setState({ stsList: this.checkItems }) + this.setState({ stsList: this.checkItems }), + this.selectedList(key) ))}; this.setState({ checkAllText: "Uncheck All" }) } }; checkRow(key){ - if(this.checkItems[key]){ - this.checkItems[key] = false, - this.setState({ statusPerRow: this.checkItems }) + if(this.checkRows[key]){ + this.checkRows[key] = false, + this.setState({ statusPerRow: this.checkRows }) for(x=0;x<5;x++){ this.checkItems[key] = false, this.setState({ stsList: this.checkItems }) + this.selectedList(key) key=key-1 } }else{ - this.checkItems[key] = true, - this.setState({ statusPerRow: this.checkItems }) + this.checkRows[key] = true, + this.setState({ statusPerRow: this.checkRows }) for(x=0;x<5;x++){ this.checkItems[key] = true, this.setState({ stsList: this.checkItems }) + this.selectedList(key) key=key-1 } } } + + proceed = () => { + this.props.navigation.navigate('QuizFlash',this.state.idList); + }; + + selectedList(key){ + if(this.checkItems[key]){ + if(katakanaList[key].id !=""){ + this.setState((previousState) => { + previousState.idList.push(katakanaList[key].id); + return previousState; + }) + } + }else{ + if(katakanaList[key].id !=""){ + this.setState((previousState) => { + var idIndex = previousState.idList.indexOf(katakanaList[key].id); + previousState.idList.splice(idIndex,1); + return previousState; + }) + } + } + } + + } const quizStyles = require('../../styles/quizStyle'); diff --git a/app/screens/home.js b/app/screens/home.js index f5ccfc3..5bbb6ad 100644 --- a/app/screens/home.js +++ b/app/screens/home.js @@ -47,7 +47,7 @@ import { this.props.navigation.navigate('HiraganaExp'); }; quiz = () => { - this.props.navigation.navigate('QuizList'); + this.props.navigation.navigate('QuizMain'); }; scoreScreen = () => { this.props.navigation.navigate('ScoreScreen',{