김서영

add components

...@@ -2,6 +2,7 @@ import React from 'react'; ...@@ -2,6 +2,7 @@ import React from 'react';
2 import { View, Text} from 'react-native'; 2 import { View, Text} from 'react-native';
3 import {connect} from 'react-redux' 3 import {connect} from 'react-redux'
4 import Icon from 'react-native-vector-icons/FontAwesome'; 4 import Icon from 'react-native-vector-icons/FontAwesome';
5 +import RateMessage from '../RateMessage/RateMessage';
5 import RateSentence from '../RateSentence/RateSentence'; 6 import RateSentence from '../RateSentence/RateSentence';
6 import RateBar from '../RateBar/RateBar'; 7 import RateBar from '../RateBar/RateBar';
7 import RateLine from '../RateLine/RateLine'; 8 import RateLine from '../RateLine/RateLine';
...@@ -10,8 +11,9 @@ import scoring from '../../lib/scoring'; ...@@ -10,8 +11,9 @@ import scoring from '../../lib/scoring';
10 const Rate = ({score}) => { 11 const Rate = ({score}) => {
11 return( 12 return(
12 <View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0, justifyContent:'center',alignItems:'center'}}> 13 <View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0, justifyContent:'center',alignItems:'center'}}>
14 + <RateMessage />
13 <RateSentence /> 15 <RateSentence />
14 - <RateBar score={score}/> 16 + <RateBar score={score}/>
15 <RateLine /> 17 <RateLine />
16 </View> 18 </View>
17 ) 19 )
...@@ -28,6 +30,6 @@ RateContainer.navigationOptions={ ...@@ -28,6 +30,6 @@ RateContainer.navigationOptions={
28 30
29 export default connect( 31 export default connect(
30 ({search})=>({ 32 ({search})=>({
31 - score: scoring(search.result.return_data) 33 + score: search.score
32 }) 34 })
33 )(RateContainer); 35 )(RateContainer);
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -10,7 +10,7 @@ export default RateBar = (props) => { ...@@ -10,7 +10,7 @@ export default RateBar = (props) => {
10 return ( 10 return (
11 <Surface style={styles.surface}> 11 <Surface style={styles.surface}>
12 12
13 - {props.score.msg.length ? 13 + {props.score.msg ?
14 <> 14 <>
15 <View style={styles.container}> 15 <View style={styles.container}>
16 <Text style={styles.Text}> 점수 : {props.score.full}</Text> 16 <Text style={styles.Text}> 점수 : {props.score.full}</Text>
......
...@@ -38,7 +38,7 @@ const RateLine = ({load,pastScore }) => { ...@@ -38,7 +38,7 @@ const RateLine = ({load,pastScore }) => {
38 const styles = StyleSheet.create({ 38 const styles = StyleSheet.create({
39 surface: { 39 surface: {
40 padding: 8, 40 padding: 8,
41 - flex: 0.4, 41 + flex: 0.3,
42 width: '95%', 42 width: '95%',
43 alignItems: 'center', 43 alignItems: 'center',
44 justifyContent: 'center', 44 justifyContent: 'center',
......
1 +import React,{ useState } from 'react';
2 +import { Surface, Text } from 'react-native-paper';
3 +import { StyleSheet,View } from 'react-native';
4 +import {connect} from 'react-redux';
5 +import PromptSearchRate from '../PromptSearch/PromptSearchRate';
6 +
7 +const SentenceInfo = (props) => (
8 + <View>
9 + <Text style={[styles.Text,{color:props.color}]}>{props.Text}</Text>
10 + </View>
11 +)
12 +
13 +const RateMessage = ({keywordText, score }) => {
14 +
15 + return (
16 + <Surface style={styles.surface} >
17 + { keywordText ?
18 + <>
19 + <View style={{textAlign:"center", height:35}}>
20 + <Text >길잡이가 교정해준 문장을 확인하세요!</Text>
21 + </View>
22 + <View>
23 + <Text style={styles.msg} >{score.msg}</Text>
24 + </View>
25 + <View>
26 + <SentenceInfo Text={keywordText} color={'#281e94'} />
27 + </View>
28 + </>
29 + : <PromptSearchRate />
30 + }
31 + </Surface>
32 + )
33 +}
34 +
35 + const styles = StyleSheet.create({
36 + surface: {
37 + padding: 8,
38 + flex: 0.3,
39 + width: '95%',
40 + alignItems: 'center',
41 + justifyContent: 'center',
42 + elevation: 2,
43 + marginTop: 10
44 + },
45 + Text:{
46 + fontSize: 25,
47 + textAlign:'center'
48 + },
49 + infoText:{
50 + fontSize: 20,
51 + textAlign:'center'
52 + },
53 + msg:{
54 + fontSize: 20,
55 + textAlign:'center',
56 + },
57 +});
58 +
59 +
60 +const RateMessageContainer = ( { keywordText, score } ) => (
61 + <RateMessage keywordText={keywordText} score={score} />
62 +);
63 +
64 +export default connect(
65 + ({search})=>({
66 + keywordText: search.result.return_data.keywordText,
67 + score : search.score
68 + })
69 +)(RateMessageContainer);
...\ No newline at end of file ...\ No newline at end of file