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>
);}