ReactNative 关于TextInput的使用

1、基本属性使用

import React,{Component} from 'react'
import {
    View,
    AlertIOS,
    TouchableHighlight,
    Button,
    ActivityIndicator,
    StyleSheet,
    Alert,
    Text,
    Image,
    AppRegistry,
    TextInput,
    Dimensions,
    dismissKeyboard,
    TouchableWithoutFeedback,
    
} from 'react-native'
export default class FlexboxDemo extends Component {

constructor(props) {
    super(props);
    this.state = {

    color:'red',
    value:''

    };
    }
getValue(text){
    TEST = text;

this.setState(
    {
        value:text
    }
)

}
    render() {
        return(
        
        
            
                    

                        
                            
                        

                    

                
            


        );



    }

        onButtonPress (){
            if(this.state.value.length>0){
                Alert.alert(this.state.value);
            }else{
                Alert.alert('请输入目标文字');
            }
            
        }
    
}

const styles=StyleSheet.create({
    style1:{
        backgroundColor:'#f0f0f0',
        marginTop:64,
        flex:1,
        alignItems: 'center',
        justifyContent: 'center',
    },


});

你可能感兴趣的:(ReactNative 关于TextInput的使用)