Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 每个堆栈的默认导航样式_Reactjs_React Native_React Navigation_React Navigation Stack - Fatal编程技术网

Reactjs 每个堆栈的默认导航样式

Reactjs 每个堆栈的默认导航样式,reactjs,react-native,react-navigation,react-navigation-stack,Reactjs,React Native,React Navigation,React Navigation Stack,我有一个默认的导航样式,我想合并到我的所有堆栈中,所以我有这个对象 const navigationDefaultStyle = { headerStyle: { backgroundColor:"#fff", height:60}, headerTitle: (<View style={{marginTop:5, flex: 1, flexDirection: 'row', justifyContent: 'center' }}><Image style={{ wid

我有一个默认的导航样式,我想合并到我的所有堆栈中,所以我有这个对象

const navigationDefaultStyle = {
  headerStyle: { backgroundColor:"#fff", height:60},
  headerTitle: (<View style={{marginTop:5, flex: 1, flexDirection: 'row', justifyContent: 'center' }}><Image style={{ width:140, height: 36, marginTop: 0, marginRight: 5}} source={require('./app/images/logo.png')}/></View>),
  headerRight: (<TouchableOpacity activeOpacity={0.8} onPress={ async () => {

      navigation.navigate('Settings', {transitionStyle:'default'})

    } } style={{ marginRight:15, marginTop:5 }}>
      <Icon name="cog" type="light" color="#29317C" size={26} />
    </TouchableOpacity>)
}

你可以试着通过导航道具

const navigationDefaultStyle = (navigation)=>{
  return{
   headerStyle: { backgroundColor:"#fff", height:60},
   headerTitle: (<View style={{marginTop:5, flex: 1, flexDirection: 'row', justifyContent: 'center' }}><Image style={{ width:140, height: 36, marginTop: 0, marginRight: 5}} source={require('./app/images/logo.png')}/></View>),
   headerRight: (<TouchableOpacity activeOpacity={0.8} onPress={ async () => {

      navigation.navigate('Settings', {transitionStyle:'default'})

    } } style={{ marginRight:15, marginTop:5 }}>
      <Icon name="cog" type="light" color="#29317C" size={26} />
    </TouchableOpacity>)
}}
const navigationDefaultStyle = (navigation)=>{
  return{
   headerStyle: { backgroundColor:"#fff", height:60},
   headerTitle: (<View style={{marginTop:5, flex: 1, flexDirection: 'row', justifyContent: 'center' }}><Image style={{ width:140, height: 36, marginTop: 0, marginRight: 5}} source={require('./app/images/logo.png')}/></View>),
   headerRight: (<TouchableOpacity activeOpacity={0.8} onPress={ async () => {

      navigation.navigate('Settings', {transitionStyle:'default'})

    } } style={{ marginRight:15, marginTop:5 }}>
      <Icon name="cog" type="light" color="#29317C" size={26} />
    </TouchableOpacity>)
}}
const Login = createStackNavigator({ SignIn: { screen: SignInScreen, navigationOptions: ({ navigation }) => (navigationDefaultStyle(navigation)) } });