0
react-native:在当前屏幕的顶层添加封面视图以防止用户触摸任何组件。react-native:防止用户触摸任何组件?
当用户触摸到一个组件时,我需要判断用户是否登录。如果用户没有登录,我需要提醒'请先注册',然后导航到Register
屏幕。我的问题是如何防止用户触摸任何组件。由于用户可以再次触摸相同的组件,那么模拟器将不止一次地浏览屏幕。 我正在使用react-native-easy-toast
来显示提示窗口。 如何在当前屏幕的顶部添加封面视图?我添加一个视图并设置样式index
'999',但它不起作用。
const styles = StyleSheet.create({
container: {
backgroundColor: '#EBF0F2',
},
coverV: {
backgroundColor:'red',
width:width,
height:height,
zIndex:9999,
},
title: {
position: 'absolute',
top: 20,
flex: 1,
height: 42,
width: width,
opacity: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor:'transparent'
},
icons: {
flexDirection: 'row',
flexWrap: 'wrap',
backgroundColor: 'white',
}
});
return(
<ScrollView style={styles.container}>
<StatusBar backgroundColor="rgba(0,0,0,0)" barStyle="light-content" translucent={true}/>
<Banner resources={tempArray} itemTouchFun={this.bannerNavigateFunc}/>
<View style={styles.title}>
<Image source={require('../../img/tfind.png')}/>
</View>
<View style={styles.icons}>
<Icon source={require('../../img/doctspec.png')}
onPress={this.onDoctor.bind(this)}
title='Icon1' />
<Icon source={require('../../img/osmedical.png')}
onPress={this.onOSMed}
title='Icon2' />
<Icon source={require('../../img/newdrugs.png')}
onPress={this.onMedicineBook}
title='Icon3' />
<Icon source={require('../../img/reservation.png')}
onPress={this.onOSMed}
title='Icon4' />
</View>
{this.renderNewsTabs()}
{this.renderNews()}
<View style={styles.coverV} />
<Toast ref="toast" position='center' positionValue={200}
fadeInDuration={750} fadeOutDuration={1000} opacity={0.8} />
</ScrollView>
);}