欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

React Native TextInput 输入框赋值没反应解决

程序员文章站 2022-08-14 22:47:02
textinput 输入框赋值没反应 //rnedittext部分截图 //rnedittext源码 import react, {...

textinput 输入框赋值没反应

React Native TextInput 输入框赋值没反应解决

//rnedittext部分截图

React Native TextInput 输入框赋值没反应解决




//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 (
                
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 (
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} /> ); } } }