React Native Elements -在IOS中不能在输入周围包裹可触摸的不透明度



我在使用React Native Elements Text Input时遇到了一个非常奇怪的问题。

import React, { useState } from 'react';
import { TouchableOpacity, View, Dimensions } from 'react-native';
import { Input } from 'react-native-elements';
const test = () => (
<TouchableOpacity onPress={() => console.log('we hit here')}>
<Input disabled>
{children}
</Input>
</TouchableOpacity>
)
export default test;

所以输入域的外缘是完全可以点击的,但是,组件的中心,它不能被点击。

这对于android来说是完美的。

有什么想法

如果有人有这个问题,那么你需要为整个组件提供一个指向'none'的指针事件:

<View pointerEvents='none'>
<Input disabled>
{children}
</Input>
</View>

Mubeen hussain的答案是正确的,但更准确地说,是这样的

<TouchableOpacity onPress={() => console.log('we hit here')}>
<View pointerEvents="none">
<Input disabled>{children}</Input>
</View>
</TouchableOpacity>

最新更新