/** * Created by zack on 2018/4/27. */ import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, Keyboard, ScrollView } from 'react-native' import React, {Component} from 'react' import {NavigationBarHeight, TabBarHeight, ScreenDimensions} from '../../../utils/DimensionsTools' export default class TranslationView extends Component { constructor(props) { super(props) this.state = { evaluationSelectedIndex: 0, isVerified: props.isVerified, isShowAnswer: false } } componentWillReceiveProps(props) { this.setState({isVerified: props.isVerified}) } renderAnswer(isShow) { if (isShow) { return( {"Picasso once said this, he said that all children are born artists. The problem is to remain an artist as we grow up. "} ) }else { return( { this.setState({isShowAnswer: true}) }}> {'点击查看答案'} ) } } render() { return( {"Picasso once said this, he said that all children are born artists. The problem is to remain an artist as we grow up. "} {this.renderAnswer(this.state.isShowAnswer)} {'自我感觉:'} { this.setState({ evaluationSelectedIndex: 0 }) }} style={styles.EvaluationButton}> {'好'} { this.setState({ evaluationSelectedIndex: 1 }) }} style={styles.EvaluationButton}> {'不好'} ) } } const styles = StyleSheet.create({ View: { width: ScreenDimensions.width, height: ScreenDimensions.height - NavigationBarHeight.height - TabBarHeight.height - 18, marginTop: NavigationBarHeight.height }, ContainerView: { alignItems: 'center' }, TitleTextBgView: { marginTop: 15, flexDirection: 'row', width: ScreenDimensions.width, }, VoiceIconButton: { width: 30, height: 30, marginLeft: 15, }, VoiceIconImageView: { width: 30, height: 30, }, TitleText: { marginLeft: 10, fontSize: 18, color: '#333333', width: ScreenDimensions.width - 40 - 10 - 30, }, TextInputBgView: { marginTop: 30, width: ScreenDimensions.width - 30, height: 165, backgroundColor: '#e5e5e5', borderTopLeftRadius: 6, borderTopRightRadius: 6, }, TextInput: { width: ScreenDimensions.width - 30, height: 165, textAlignVertical: 'top', fontSize: 16, paddingLeft: 12, paddingTop: 12, paddingRight: 12, paddingBottom: 12 }, AnswerButtonText: { marginTop: 30, fontSize: 18, color: '#666666', marginBottom: 56, }, AnswerText: { marginTop: 0, marginBottom: 25, width: ScreenDimensions.width - 30, height: (ScreenDimensions.height - NavigationBarHeight.height - TabBarHeight.height - 76 - 160)/2.0, backgroundColor: '#efffe3', fontSize: 16, paddingLeft: 10, paddingTop:10, paddingRight:10, paddingBottom: 10, color: '#666666' }, EvaluationBgView: { flexDirection: 'row', alignItems: 'center', }, EvaluationButton: { flexDirection: 'row', alignItems: 'center', }, EvaluationButtonImageView: { width: 22, height: 22, }, EvaluationButtonText: { fontSize: 18, color: '#666666' }, FooterView: { width: ScreenDimensions.width, height: 44, backgroundColor: '#ffffff' } })