React Native TextInput 输入框赋值没反应


TextInput 输入框赋值没反应 

 

//RnEditText部分截图

 





//RnEditText源码

import React, {
Component,
PropTypes
} from 'react';

import {
View,
Text,
Image,
TextInput,
StyleSheet,
} from 'react-native';

import AutoUtil from '../utils/AutoUtil';


export default class RnEditText extends Component {
static propTypes = {
autoFocus: PropTypes.bool,
caretHidden: PropTypes.bool,
editable: PropTypes.bool,
keyboardType: PropTypes.string,
textAlign: PropTypes.string,
maxLength: PropTypes.number,
multiline: PropTypes.bool,
onBlur: PropTypes.func,
onChange: PropTypes.func,
onChangeText: PropTypes.func,
onEndEditing: PropTypes.func,
onFocus: PropTypes.func,
hint: PropTypes.string,
value: PropTypes.string,
secureTextEntry: PropTypes.bool,
outStyle: PropTypes.number,
textAlignVertical : PropTypes.string,
textAlign : PropTypes.string,
};


render() {
let Platform = require('Platform');
if (Platform.OS === 'android') {
return (
<TextInput
autoFocus={this.props.autoFocus}
caretHidden={this.props.caretHidden}
editable={this.props.editable}
keyboardType={this.props.keyboardType}
textAlign={this.props.textAlign}
maxLength={this.props.maxLength}
multiline={this.props.multiline}
onBlur={this.props.onBlur}
onChange={this.props.onChange}
onChangeText={this.props.onChangeText}
onEndEditing={this.props.onEndEditing}
onFocus={this.props.onFocus}
placeholder={this.props.hint}
placeholderTextColor={'#cccccc'}
value={this.props.value}
secureTextEntry={this.props.secureTextEntry}
underlineColorAndroid='transparent'
style={[this.props.outStyle, {padding: 0}]}
textAlignVertical = {this.props.textAlignVertical}
/>
);
} else {
return (
<TextInput
autoFocus={this.props.autoFocus}
caretHidden={this.props.caretHidden}
editable={this.props.editable}
keyboardType={this.props.keyboardType}
textAlign={this.props.textAlign}
maxLength={this.props.maxLength}
multiline={this.props.multiline}
onBlur={this.props.onBlur}
onChange={this.props.onChange}
onChangeText={this.props.onChangeText}
onEndEditing={this.props.onEndEditing}
onFocus={this.props.onFocus}
placeholder={this.props.hint}
placeholderTextColor={"#cccccc"}
value={this.props.value}
secureTextEntry={this.props.secureTextEntry}
style={this.props.outStyle}
/>
);
}
}

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM