We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题描述 View标签包裹Input标签,View标签点击事件无效
复现步骤 [复现问题的步骤]
[或者可以直接贴源代码,能贴文字就不要截图]
<View className="input-wrap" onClick={this.toSearch.bind(this)}> <Input type='text' className="top-input" value={keyword} disabled placeholder="请输入关键字搜索" /> {keyword ? <Image mode='aspectFill' src={Close} className='close' onClick={this.clearKeyword.bind(this)} /> : ''} </View>
期望行为 正常执行点击事件
报错信息 没有报错,但控制台不打印任何东西【函数不执行】
系统信息
The text was updated successfully, but these errors were encountered:
React Native 的特殊性,最终处理事件的也就只有一个层组件,通常实现你要的效果需要:
<TouchableOpacity onPress={() => console.log("Pressed")}> <TextInput pointerEvents="none" /> </TouchableOpacity>
即通过 pointerEvents 属性阻止内层捕获触摸事件(或只让外层组件捕获事件),这样 TextInput 会无法处理相关触摸操作,比如 focus。
pointerEvents
所以并不建议这样写,你这里完全可以用 Text 来代替。如果确实有这个需要,可以传入给 Input 传入 pointerEvents(未支持)
Sorry, something went wrong.
Manjiz
No branches or pull requests
问题描述
View标签包裹Input标签,View标签点击事件无效
复现步骤
[复现问题的步骤]
[或者可以直接贴源代码,能贴文字就不要截图]
期望行为
正常执行点击事件
报错信息
没有报错,但控制台不打印任何东西【函数不执行】
系统信息
The text was updated successfully, but these errors were encountered: