Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #32 from ZendyLim/feature/#21_quiz_list_screen
Browse files Browse the repository at this point in the history
Feature/#21 quiz list screen
  • Loading branch information
viinkelvin authored May 19, 2018
2 parents 74c5ea3 + 738cfb8 commit e620caf
Show file tree
Hide file tree
Showing 13 changed files with 2,485 additions and 672 deletions.
2,536 changes: 1,892 additions & 644 deletions app/config/data.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions app/config/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import TopicListScreen from '../screens/Study/topiclist';
import HiraganaListScreen from '../screens/Study/hiraganaList';
import LearnListScreen from '../screens/Learn/LearnList';
import LearnHiraganaModule from '../screens/Learn/LearnModule';
import QuizMainScreen from '../screens/Quiz/quizMain';
import QuizListScreen from '../screens/Quiz/quizList';
import QuizHiraganaListScreen from '../screens/Quiz/quizHiraganaList';
import QuizKatakanaListScreen from '../screens/Quiz/quizKatakanaList';
import HiraganaExplanationScreen from '../screens/Study/hiraganaExplanation';
import ScoreScreen from '../screens/Study/score';
//import Summary Screen
Expand All @@ -35,6 +39,8 @@ const StudyStack = StackNavigator({
HiraganaList: HiraganaListScreen,
QuizFlash: QuizFlashScreen,
LearnListScreen: LearnListScreen,
QuizMain: QuizMainScreen,
QuizList: QuizListScreen,
LearnHiraganaModule:
{
screen: LearnHiraganaModule,
Expand All @@ -56,6 +62,12 @@ const SettingStack = StackNavigator({
SettingList: SettingScreen
});

// const QuizHiraganaListStack = StackNavigator({
// QuizHiraganaList: QuizHiraganaListScreen
// })
// const QuizKatakanaListStack = StackNavigator({
// QuizKarakanaList: QuizKatakanaListScreen
// })

export const AppStack = TabNavigator({
Home: {
Expand Down Expand Up @@ -97,6 +109,13 @@ export const AppStack = TabNavigator({
}
});

export const QuizStack = TabNavigator({
QuizHiraganaList: QuizHiraganaListScreen,
QuizKarakanaList: QuizKatakanaListScreen
}, {
tabBarPosition: 'top',
});

export const MainStack = StackNavigator({
AppStack: {
screen: AppStack,
Expand Down
2 changes: 1 addition & 1 deletion app/screens/Login/fblogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ class FBLoginView extends Component {
}
module.exports = FBLoginView;

const styles = require('../../styles/style');
const styles = require('../styles/style');
141 changes: 141 additions & 0 deletions app/screens/Quiz/quizHiraganaList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import React, { Component } from 'react';
import {
ActivityIndicator,
AsyncStorage,
Button,
StatusBar,
StyleSheet,
View,
Text,
ScrollView,
TouchableOpacity,

} from 'react-native';
import { hiraganaList } from '../../config/data';
import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox';


class QuizHiraganaListScreen extends Component {

static navigationOptions = {
title: 'Hiragana',
};
state = {
checkAllText: "Check All",
statusCheckAll: false,
stsList : false,
statusPerRow: false,
idList:[],
}

constructor(props){
super(props);
this.checkItems = [hiraganaList.map.length];
// this.CheckRows = [hiraganaList.map.length];
}

render() {
return (
<ScrollView style={quizStyles.container}>
<View style={quizStyles.containerWhiteTop}>
<View style={quizStyles.menuContainer} >
<TouchableOpacity style={quizStyles.menuButton}
onPress={()=> { this.checkAll() }}
>
<Text style={quizStyles.buttonText}>{this.state.checkAllText}</Text>
</TouchableOpacity>
<TouchableOpacity style={quizStyles.menuButton}>
<Text style={quizStyles.buttonText}>Proceed ></Text>
</TouchableOpacity>
</View>
<View style={styles.row}>
{hiraganaList.map((item, key)=>(
<View key={key} style={(key + 1) % 5 == 0 ? ( quizStyles.listContainerRow2 ) : ( quizStyles.listContainerRow )}>
<View style={quizStyles.rowButton}>
<TouchableOpacity
style={[quizStyles.mojiList,this.state.stsList[key] && quizStyles.mojiListActive]}
onPress={()=> { this.checkSingle(key) }}
>
<Text style={[quizStyles.mojiListText, this.state.stsList[key]
&& quizStyles.mojiListTextActive]}> {item.moji}
</Text>
<Text style={[quizStyles.romajiList, this.state.stsList[key]
&& quizStyles.romajiListActive]}> {item.romaji}
</Text>
</TouchableOpacity>
</View>
{ (key + 1) % 5 == 0 ? (
<View style={quizStyles.rowButtonRadio}>
<CircleCheckBox
checked={this.state.statusPerRow[key]}
onToggle={(checked) => this.checkRow(key)}
outerColor ={"#ec6f86"}
innerColor ={"#ec6f86"}
/>
</View>
) : (
<Text style={quizStyles.displayNone}>None </Text>
) }

</View>
))}
</View>
</View>
</ScrollView>
);
}

checkSingle(key) {
if(this.checkItems[key]){
this.checkItems[key] = false;
this.setState({ stsList: this.checkItems});
}
else{
this.checkItems[key] = true;
this.setState({ stsList: this.checkItems});
}
};
checkAll(){
this.setState({statusCheckAll: !this.state.statusCheckAll})
if(this.state.statusCheckAll){
{hiraganaList.map((item, key)=>(
this.checkItems[key] = false,
this.setState({ stsList: this.checkItems })
))};
this.setState({ checkAllText: "Check All" })
}else{
{hiraganaList.map((item, key)=>(
this.checkItems[key] = true,
this.setState({ stsList: this.checkItems })
))};
this.setState({ checkAllText: "Uncheck All" })
}
};
checkRow(key){
if(this.checkItems[key]){
this.checkItems[key] = false,
this.setState({ statusPerRow: this.checkItems })
for(x=0;x<5;x++){
this.checkItems[key] = false,
this.setState({ stsList: this.checkItems })
key=key-1
}
}else{
this.checkItems[key] = true,
this.setState({ statusPerRow: this.checkItems })
for(x=0;x<5;x++){
this.checkItems[key] = true,
this.setState({ stsList: this.checkItems })
key=key-1
}
}
}
getActiveid(){
this.sta
}

}

const quizStyles = require('../../styles/quizStyle');
const styles = require('../../styles/style');
export default QuizHiraganaListScreen;
136 changes: 136 additions & 0 deletions app/screens/Quiz/quizKatakanaList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import React, { Component } from 'react';
import {
ActivityIndicator,
AsyncStorage,
Button,
StatusBar,
StyleSheet,
View,
Text,
ScrollView,
TouchableOpacity
} from 'react-native';

import { katakanaList } from '../../config/data';
import CircleCheckBox, {LABEL_POSITION} from 'react-native-circle-checkbox';

class QuizKatakanaListScreen extends Component {

static navigationOptions = {
header: null,
title: 'Katakana',
};

state = {
checkAllText: "Check All",
statusCheckAll: false,
stsList : false,
statusPerRow: false,
}

constructor(props){
super(props);
this.checkItems = [katakanaList.map.length];
}

render() {
return (
<ScrollView style={quizStyles.container}>
<View style={quizStyles.containerWhiteTop}>
<View style={quizStyles.menuContainer} >
<TouchableOpacity style={quizStyles.menuButton}
onPress={()=> { this.checkAll() }}
>
<Text style={quizStyles.buttonText}>{this.state.checkAllText}</Text>
</TouchableOpacity>
<TouchableOpacity style={quizStyles.menuButton}>
<Text style={quizStyles.buttonText}>Proceed ></Text>
</TouchableOpacity>
</View>
<View style={styles.row}>
{katakanaList.map((item, key)=>(
<View key={key} style={(key + 1) % 5 == 0 ? ( quizStyles.listContainerRow2 ) : ( quizStyles.listContainerRow )}>
<View style={quizStyles.rowButton}>
<TouchableOpacity
style={[quizStyles.mojiList,this.state.stsList[key] && quizStyles.mojiListActive]}
onPress={()=> { this.checkSingle(key) }}
>
<Text style={[quizStyles.mojiListText, this.state.stsList[key]
&& quizStyles.mojiListTextActive]}> {item.moji}
</Text>
<Text style={[quizStyles.romajiList, this.state.stsList[key]
&& quizStyles.romajiListActive]}> {item.romaji}
</Text>
</TouchableOpacity>
</View>
{ (key + 1) % 5 == 0 ? (
<View style={quizStyles.rowButtonRadio}>
<CircleCheckBox
checked={this.state.statusPerRow[key]}
onToggle={(checked) => this.checkRow(key)}
outerColor ={"#ec6f86"}
innerColor ={"#ec6f86"}
/>
</View>
) : (
<Text style={quizStyles.displayNone}>None </Text>
) }

</View>
))}
</View>
</View>
</ScrollView>
);
}

checkSingle(key) {
if(this.checkItems[key]){
this.checkItems[key] = false;
this.setState({ stsList: this.checkItems });
}
else{
this.checkItems[key] = true;
this.setState({ stsList: this.checkItems });
}
};
checkAll(){
this.setState({statusCheckAll: !this.state.statusCheckAll})
if(this.state.statusCheckAll){
{katakanaList.map((item, key)=>(
this.checkItems[key] = false,
this.setState({ stsList: this.checkItems })
))};
this.setState({ checkAllText: "Check All" })
}else{
{katakanaList.map((item, key)=>(
this.checkItems[key] = true,
this.setState({ stsList: this.checkItems })
))};
this.setState({ checkAllText: "Uncheck All" })
}
};
checkRow(key){
if(this.checkItems[key]){
this.checkItems[key] = false,
this.setState({ statusPerRow: this.checkItems })
for(x=0;x<5;x++){
this.checkItems[key] = false,
this.setState({ stsList: this.checkItems })
key=key-1
}
}else{
this.checkItems[key] = true,
this.setState({ statusPerRow: this.checkItems })
for(x=0;x<5;x++){
this.checkItems[key] = true,
this.setState({ stsList: this.checkItems })
key=key-1
}
}
}
}

const quizStyles = require('../../styles/quizStyle');
const styles = require('../../styles/style');
export default QuizKatakanaListScreen;
32 changes: 32 additions & 0 deletions app/screens/Quiz/quizList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { Component } from 'react';
import {
ActivityIndicator,
AsyncStorage,
Button,
StatusBar,
StyleSheet,
View,
ToolbarAndroid,
Text,
TouchableOpacity,
} from 'react-native';
import { QuizStack } from '../../config/router';


class QuizListScreen extends Component {

static navigationOptions = {
title: 'QuizList',
};

render() {
return (
<QuizStack />
);

}
}

const styles = require('../../styles/quizStyle');

export default QuizListScreen;
Loading

0 comments on commit e620caf

Please sign in to comment.