我正在构建自定义标题。当我给组件样式属性prop-'position:“ absolute”'时,可触摸不透明组件的onPress事件不起作用。但是,当我对样式属性-位置进行评论时,它可以完美工作。 我在其他地方找不到解决方案。请帮忙。
mergeMap
答案 0 :(得分:0)
它在下面的代码进行我的案件结帐时起作用: 或查看我的零食示例:https://snack.expo.io/@immynk/header_demo
您是否缺少提供条件的参数或条件检查为空,请确认它希望此答案对您有帮助
import * as React from 'react';
import {
Text,
View,
StyleSheet,
Animated,
TouchableOpacity,
Image,
} from 'react-native';
import Constants from 'expo-constants';
export default class App extends React.Component {
render() {
return (
<View>
<Text>Hello this is demo of flexdirection of box color</Text>
<Animated.View
style={{
position: 'absolute',
top: 0,
left: 0,
backgroundColor: 'red',
width: '100%',
height: 50,
justifyContent: 'space-between',
alignItems: 'center',
flexDirection: 'row',
paddingHorizontal: 20,
}}>
<TouchableOpacity style={{}} onPress={() => alert("hello","hello")}>
<View style={{}}>
<Image
source={{ uri: 'https://reactjs.org/logo-og.png' }}
style={{ width: 50, height: 65 }}
/>
</View>
</TouchableOpacity>
<TouchableOpacity style={{}} onPress={() => alert("hello","hello")}>
<View style={{}}>
<Image
source={{ uri: 'https://reactjs.org/logo-og.png' }}
style={{ width: 50, height: 65 }}
/>
</View>
</TouchableOpacity>
</Animated.View>
</View>
);
}
}
答案 1 :(得分:0)
您应将$ jq -r '.results.unique_id' file
37c23e60-5b83-404a-bd1f-6733ef04463b
位置 cap = cv2.VideoCapture(open('file.txt').read())
放在屏幕组件的最后一个子位置。否则,占据屏幕其余部分的视图将成为触摸的响应者。
absolute
在DOM中,另一个组件之后的组件被放置在它的“上方”。因此,如果您执行此操作,则标题将位于实际屏幕内容视图的上方,因此在被按下时成为响应者。