У меня проблема с прозрачным экраном внутри другого StackNagigation. демо
Я хочу показать ScreenThree
оверлей перед ScreenTwo
после нажатия кнопки Go to ScreenThree
в ScreenTwo.
Я установил cardStyle
сbackgroundColor: 'transparent'
но все равно не работает.
Я не знаю, что здесь не так?Кто-нибудь, пожалуйста, помогите мне?
import { StackNavigator } from 'react-navigation'; // 2.2.5
import React from 'react'
import { Image, View, Text, Button } from 'react-native'
import { StyleSheet, Dimensions, TouchableOpacity } from 'react-native'
export default class App extends React.Component {
render() {
return (
<View style={{flex: 1, backgroundColor: 'red'}}>
<Root/>
</View>
)
}
}
class HomeScreen extends React.Component {
render() {
return (
<View style={{
backgroundColor: 'blue',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingTop: 20
}}>
<TouchableOpacity onPress={
() => {
this.props.navigation.navigate('ScreenTwo')}
}
style={{
padding: 16,
backgroundColor: 'gray'
}}>
<Text>
Go to ScreenTwo
</Text>
</TouchableOpacity>
</View>
)
}
}
class ScreenTwo extends React.Component {
render() {
return (
<View style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}}>
<Text style={{color: 'white'}}>
ScreenTwo
</Text>
<TouchableOpacity onPress={
() => {
this.props.navigation.navigate('ScreenThree')}
}
style={{
padding: 16,
backgroundColor: 'gray',
marginTop: 16
}}>
<Text>
Go to ScreenThree
</Text>
</TouchableOpacity>
</View>
)
}
}
class ScreenThree extends React.Component {
render() {
return (
<View style={{
backgroundColor: 'rgba(0,0,0,0.3)',
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}}>
<Text style={{color: 'white'}}>
ScreenThree
</Text>
</View>
)
}
}
const DetailStack = StackNavigator({
ScreenThree: {screen: ScreenThree}
}, {
mode: 'modal',
headerMode: 'none',
cardStyle: {
backgroundColor: 'transparent',
shadowColor: 'transparent'
},
})
const MainStack = StackNavigator({
HomeScreen: {screen: HomeScreen},
ScreenTwo: {screen: ScreenTwo},
DetailStack: {screen: DetailStack}
},
{
headerMode: 'none',
cardStyle: {shadowColor: 'transparent'},
})
const Root = StackNavigator({
Main: {screen: MainStack}
},
{
mode: 'modal',
headerMode: 'none',
cardStyle: {
shadowColor: 'transparent'
},
})