• AEPKILL
    2022-04-15
    iOS 模拟器也是可以弹出键盘的,只要把 Hardware -> Keyboard -> Connect HardWare KeyBoard 的勾去掉就可以了。 验证码组件我的思路是这样的: 1. 放置一个隐藏的 TextInput 2. 画短信验证码输入的 UI (其实就是几个格子) 3. 点击验证码 UI 的时候调用 textInptRef.focus() 4. 接受输入,划到对应的验证码格子里 完整代码: https://gist.github.com/AEPKILL/3557c4b5b621a3aec36e7e3cd8571e56

    作者回复: iOS 模拟器可以弹出键盘,学到了👍 除了隐藏 TextInput 我还有一种思路,就是直接使用显示的 TextInput + letterSpacing 控制字间距。

    共 3 条评论
    7
  • 小天儿
    2022-05-16
    老师,TextInput 间进行跳转时,键盘总是会先收起再弹出,而在某些应用中,多个输入框之间跳转是不会收起键盘的,如何解决这个问题呢?

    作者回复: 你可以试着将 ScrollView 组件的 keyboardShouldPersistTaps 属性设置为 handled 试试。 文档如下: keyboardShouldPersistTaps:Determines when the keyboard should stay visible after a tap. - 'never' tapping outside of the focused text input when the keyboard is up dismisses the keyboard. When this happens, children won't receive the tap. - 'always', the keyboard will not dismiss automatically, and the scroll view will not catch taps, but children of the scroll view can catch taps. - 'handled', the keyboard will not dismiss automatically when the tap was handled by children of the scroll view (or captured by an ancestor).

    
    2
  • dao
    2022-04-17
    1, 新手,代码 https://github.com/hdouhua/hybrid-mobile-app/tree/main/AwesomeProject/src/c07。 2,不知道怎么的,在文档里找不到 TextInput 的方法 onChangeSync

    作者回复: 给你认真的学习态度点赞。 1. 实际上输入手机验证码这道题,它只需要一个,textinput 能够实现哦,我看到你有比较多 text,这一块还有改进空间。 关键提示:letterSpacing 2. onChangeSync 它还是一个私有的属性,你可以在源码中看到。

    共 3 条评论
    
  • 见字如晤
    2022-05-17
    还有一个特别重要的细节是,输入框与键盘的位置。键盘弹起的时候,是否有遮盖输入框的表现;如果没有,键盘会不会把整个页面往上顶起;Android和iOS表现这方面表现是否一致
    
    2
  • Wcly👺
    2022-11-21 来自广东
    要做一个文本编辑器,怎么控制光标适中在可视区域,就是横向输入长文本到输入框的时候能自动横向滚动,垂直换行的时候能自动垂直滚动,类似vscode的编辑页面。
    
    
  • Hozan
    2022-08-10 来自广东
    TextInput是不是没法禁止它复制粘贴?在Android上不生效
    
    
  • 大神博士
    2022-07-05
    “但是 Fabric 之后(包括 Fabric 预览版),setNativeProps 就不能用了。” 有传送门吗?
    
    
  • 下一刻。
    2022-06-13
    老师问一下:TextInput如何插入图片(自定义表情),如何使不同段的文字颜色不一样(话题)。
    
    
  • 小天儿
    2022-05-16
    1. 代码:https://snack.expo.dev/@sh-winter/textinput 2. onChnage 与 onChangeSync 的区别:个人认为 onChangeSync 比 onChange 响应的更快,适用于更高优先级的场景;Fabric 同步的特性与 react 18 结合将带来并发渲染,可中断渲染等新特性,实现在大规模 UI 更新时保持响应
    
    