react-native - 为什么 hitSlop 在这个嵌套的 TouchableOpacity 组件中不起作用?
问题描述
我有一个嵌套的 TouchableOpacity 组件,如下所示:
<View style={styles.mainTextContainer}>
<Text>
{mainText}
<TouchableOpacity
hitSlop={{top: Gutter, left: Gutter, bottom: Gutter, right: Gutter}}
style={styles.icon}
onPress={onPress}>
{mainTextIcon}
</TouchableOpacity>
</Text>
</View>
// These are the corresponding styles
icon: {
justifyContent: "center",
},
mainTextContainer: {
flexDirection: "row",
flexWrap: "wrap",
justifyContent: "flex-start",
},
但是,似乎 hitSlop 道具不起作用。是因为它嵌套在 Text 组件中吗?
解决方案
推荐阅读
- variables - 如何从赛普拉斯的另一个 cy 函数中获取价值
- sql - 语句SQL的案例
- c - C - 实现 Char * 数组的队列
- javascript - Jquery 未以 HTML 形式定义
- javascript - (节点:8592)UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝 id:3):MongoParseError:无效的连接字符串
- c++ - 从派生构造函数调用基类的虚函数
- google-tag-manager - 谷歌标签管理器在外部插入自定义 HTML
- tree - Angular 组件 mat-tree 展开所有节点
- python - 散点图中两个特征之间的比例
- perl - 终端窗口和 txt 文件中的输出不同?