React Native TextInput blur消耗TouchableHighlight按事件 [英] React Native TextInput blur consumes TouchableHighlight press event

查看:387
本文介绍了React Native TextInput blur消耗TouchableHighlight按事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点按红色的发布按钮时,我想要提交< TextInput> < TouchableHighlight> 。当TextInput聚焦时,我完成输入并点击Post按钮,键盘关闭但按钮没有注册水龙头。

I have a <TextInput> that I'd like to submit when I tap the red Post button, a <TouchableHighlight>. When the TextInput is focused, I finish typing and I tap on the Post button, the keyboard closes but the button doesn't register the tap.

我尝试使用TextInput onBlur 事件,但它没有给我触点的坐标,所以我不知道触点是否实际上是在按钮上。

I tried using the TextInput onBlur event, but It doesn't give me the coordinates of the touch point, so I don't know if the touch point is actually over the button or not.

推荐答案

你需要将属性keyboardShouldPersistTaps = {true}添加到你的ScrollView。

You need to add the property keyboardShouldPersistTaps={true} to your ScrollView.

这是什么 docs 说:


keyboardShouldPersistTaps bool:

如果为false,则在$时点击焦点文本输入之外b $ b键盘关闭了键盘。如果为true,滚动视图将为
无法捕捉,并且键盘不会自动消除。
默认值为false。

When false, tapping outside of the focused text input when the keyboard is up dismisses the keyboard. When true, the scroll view will not catch taps, and the keyboard will not dismiss automatically. The default value is false.

这篇关于React Native TextInput blur消耗TouchableHighlight按事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆