我尝试显示一个覆盖图:
Navigation.showOverlay({component:{name:'app.overlay'}})
但是叠加层会显示在新屏幕中...
为什么叠加层未显示在当前屏幕上?
// Register screens ...
Navigation.registerComponent('app.home', () => AppHome);
Navigation.registerComponent('app.overlay', () => TestOverlay);
// Set stack root
Navigation.setRoot({
root: {
stack: {
children: [{ component: { name: 'app.home' } }]
}
},
});
// AppHome component
<SafeAreaView style={styles.container}>
<Button
onPress={() => Navigation.showOverlay({ component: { name : 'app.overlay' } })}
label="Press me"
/>
</SafeAreaView>
// Overlay
<View style={{ ...StyleSheet.absoluteFill, opacity: 0.5, backgroundColor: 'red' }}>
<Text>Test overlay</Text>
</View>