From 79cb7fd8d3607235ca7ed28211dba648c5d22d0d Mon Sep 17 00:00:00 2001 From: davidpborromeo Date: Fri, 1 Jun 2018 10:11:26 +0900 Subject: [PATCH] #50 add test --- app/component/answerButton.js | 81 ----------------------------------- app/component/fillButton.js | 2 +- app/component/quiz.js | 6 +-- app/config/quiz.js | 18 ++++---- app/screens/Quiz/quizFlash.js | 11 +++-- app/styles/style.js | 4 +- 6 files changed, 23 insertions(+), 99 deletions(-) diff --git a/app/component/answerButton.js b/app/component/answerButton.js index 9089e88..e69de29 100644 --- a/app/component/answerButton.js +++ b/app/component/answerButton.js @@ -1,81 +0,0 @@ -import React, { Component } from 'react'; -import { TouchableHighlight, Image, View, Text } from 'react-native'; -import PropTypes from 'prop-types'; -import Icon from 'react-native-vector-icons/FontAwesome'; - -/** - Quiz Button -**/ -class AnswerButton extends Component { - static propTypes = { - textDisplay: PropTypes.string.isRequired, - textData: PropTypes.object, - selected: PropTypes.bool, - id: PropTypes.string, - isCorrect: PropTypes.number, - styleFormat: PropTypes.string - }; - - constructor(props) { - super(props); - - } - - _renderIcon(){ - let iconName = ''; - console.log(this.props.isCorrect); - switch (this.props.isCorrect) { - case 1: - iconName = 'circle-o'; - break; - - case 0: - iconName = 'times'; - break; - - default: - return null; - break; - } - - centerIcon = ['quizSquared','quizKanji']; - center = centerIcon.indexOf(this.props.styleFormat) > -1; - - return( - - - - ); - - } - - render(){ - - return ( - - { this._renderIcon() } - this.onSelectAnswer() } - > - - { this.props.textDisplay } - - - - ); - } - - onSelectAnswer(){ - if(this.props.isCorrect == -1){ - this.props.onSelectAnswer(this.props.id); - } - - } - - -} -module.exports = AnswerButton; - -const styles = require('../styles/style'); \ No newline at end of file diff --git a/app/component/fillButton.js b/app/component/fillButton.js index 728c2a5..0a3c974 100644 --- a/app/component/fillButton.js +++ b/app/component/fillButton.js @@ -45,7 +45,7 @@ class FillButton extends Component { } return( - + ); diff --git a/app/component/quiz.js b/app/component/quiz.js index b4cb763..36e428d 100644 --- a/app/component/quiz.js +++ b/app/component/quiz.js @@ -50,7 +50,7 @@ class Quiz extends Component { } else{ return( - + { this.props.answerOptions.map((item)=>( + { this._renderAnswerButtons() } - + ); } diff --git a/app/config/quiz.js b/app/config/quiz.js index be36e1c..0973750 100644 --- a/app/config/quiz.js +++ b/app/config/quiz.js @@ -119,8 +119,8 @@ let topic_title_grammar= [ "id":"tpg1_1", "type":"grammar", "romaji":"kanako-san ha gakusei desu.", - "moji":"かなこさんはがくせいです。", - "kanji":"かなこさんは学生です", + "moji":"かなこさん は がくせい です。", + "kanji":"かなこさん は 学生 です", "english":"Kanako is a student", "audio":"ne.mp3" }, @@ -128,7 +128,7 @@ let topic_title_grammar= [ "id":"tpg1_2", "type":"grammar", "romaji":"kanako-san ha jaarimasen.", - "moji":"かなこさんはがくせいじゃありません。", + "moji":"かなこさん は がくせい じゃありません。", "kanji":"かなこさんは学生じゃありません", "english":"Kanako is not a student", "audio":"ne.mp3" @@ -137,8 +137,8 @@ let topic_title_grammar= [ "id":"tpg1_3", "type":"grammar", "romaji":"kanako-san ha desu ka.", - "moji":"かなこさんはがくせいですか。", - "kanji":"かなこさんは学生ですか", + "moji":"かなこさん は がくせい です か。", + "kanji":"かなこさん は 学生 です か", "english":"Is kanako a student?", "audio":"ne.mp3" }, @@ -146,8 +146,8 @@ let topic_title_grammar= [ "id":"tpg1_4", "type":"grammar", "romaji":"kanako-san ha takumi-san ga wakarimasu.", - "moji":"かなこさんはたくみさんがわかります。", - "kanji":"かなこさんはたくみさんが分かります。", + "moji":"かなこさん は たくみさん が わかります。", + "kanji":"かなこさん は たくみさん が 分かります。", "english":"Kanako knows Takumi", "audio":"ne.mp3" }, @@ -155,8 +155,8 @@ let topic_title_grammar= [ "id":"tpg1_5", "type":"grammar", "romaji":"kanako-san ha takumi-san ga wakarimasen.", - "moji":"かなこさんはたくみさんがわかりません。", - "kanji":"かなこさんはたくみさんが分かりません。", + "moji":"かなこさん は たくみさん が わかりません。", + "kanji":"かなこさん は たくみさん が 分かりません。", "english":"Kanako does not know Takumi", "audio":"ne.mp3" } diff --git a/app/screens/Quiz/quizFlash.js b/app/screens/Quiz/quizFlash.js index 06c1aae..ac33e97 100644 --- a/app/screens/Quiz/quizFlash.js +++ b/app/screens/Quiz/quizFlash.js @@ -2,9 +2,10 @@ import React, { Component } from 'react'; import { View, Text, - TouchableHighlight + TouchableHighlight, + ScrollView } from 'react-native'; - import { List, ListItem, ScrollView } from 'react-native-elements'; + import { strings } from '../../config/localization'; import { bindActionCreators } from 'redux'; @@ -147,7 +148,7 @@ import { } - + { !this.state.showCorrect ? @@ -175,7 +176,7 @@ import { ) } - + @@ -189,6 +190,8 @@ import { componentWillMount() { const { navigation } = this.props; + + console.log(this.props.navigation); this.oneType = navigation.getParam('oneType',null); this.mounted = true; idList = navigation.getParam('idList', null); diff --git a/app/styles/style.js b/app/styles/style.js index 898afac..883e09b 100644 --- a/app/styles/style.js +++ b/app/styles/style.js @@ -579,7 +579,9 @@ module.exports = StyleSheet.create({ paddingTop:13 }, quizAnswerWrapper:{ - position:'relative' + position:'relative', + backgroundColor:'red', + height: window.height - 100 }, blocker:{ position:'absolute',