您好,欢迎来到12图资源库!分享精神,快乐你我!我们只是素材的搬运工!!
  • 首 页
  • 当前位置:首页 > 开发 > WEB开发 >
    我在运用React Native/Redux开发中犯过的11个错误(4)
    时间:2018-01-12 21:40 来源:网络整理 作者:网络 浏览:收藏 挑错 推荐 打印

                        {title}                

                    </Text> 

                   <TextInput 

                       onChange={this.props.onChange} 

                       value={this.props.value} /> 

                </View

            ) 

        } 

    FormItem.propTypes = { 

        title: PropTypes.string, 

        value: PropTypes.string, 

        onChange: PropTypes.func.isRequired 

     

    class Button extends Component{ 

        constructor(props){ 

            super(props); 

        } 

        render(){ 

            let title = this.props.title; 

            return(             

                <TouchableOpacity onPress={this.props.onPress}> 

                    <View style={styles.btn}> 

                        <Text style={styles.btnText}> 

                            {title}                     

                        </Text> 

                    </View

                </TouchableOpacity> 

            ) 

        } 

                 

    Button.propTypes = { 

        title: PropTypes.string, 

        onPress: PropTypes.func.isRequired 

    export default class SomeContainer extends Component { 

        constructor(props){ 

            super(props); 

            this.state = { 

                username:null 

            } 

        } 

        _usernameChanged(event){ 

            this.setState({ 

                username:event.nativeEvent.text  

            }); 

        } 

        _submit(){ 

            if(this.state.username){ 

                console.log(`Hello, ${this.state.username}!`); 

            } 

            else

                console.log('Please, enter username'); 

            } 

        } 

        render() { 

    (责任编辑:admin)