Meituan-Dianping / beeshell

React Native 组件库
MIT License
1.8k stars 280 forks source link

为什么ios不能输入中文? #16

Closed liyuandie closed 5 years ago

liyuandie commented 5 years ago

问题是什么

ios模拟器开发,input框不能输入中文

环境

在线例子

<View style={styles.container}>
        <View>
          <Form>
            <FormItem prop="mobile" label="手机号" hasLine style={styles.formItemLabel}>
              <Input
                placeholder="请输入手机号"
                textAlign="left"
                value={this.state.name}
                onChange={text => {
                  this.setState({ mobile: text });
                  console.log(this.state.mobile);
                }}
              />
            </FormItem>
            <FormItem prop="password" label="密码" hasLine>
              <Input placeholder="请输入密码" textAlign="left" value={this.state.password} />
            </FormItem>
          </Form>
        </View>
      </View>

其他

其他信息

mactive commented 5 years ago

以我的了解. iOS的模拟器是没有中文输入法的. 可以考虑从mac 复制然后粘贴进去.

liyuandie commented 5 years ago

@mactive 这似乎是RN自身的问题,打包过后到真机也并不能输入

afresh commented 5 years ago

rn版本升级到0.57.1以上即可。

menglingyu commented 5 years ago

onChange会调用setState, 导致拼音没打完,就 调用onChange了, setState,解决办法,输入的值存到this里,而不是state里

liyuandie commented 5 years ago

@afresh 我的rn版本是0.57.2

afresh commented 5 years ago

@afresh 我的rn版本是0.57.2 你代码里value和onChange的state都不一样。 rn确实已经修复ios不能输入中文的问题了。