首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >反应-导航更多的页眉?

反应-导航更多的页眉?
EN

Stack Overflow用户
提问于 2017-12-22 15:50:47
回答 1查看 78关注 0票数 0

标签和堆栈,当使用时,出现多个标题后跳转到下一个页面样式,我的反应-导航配置有问题吗?有更好的解决方案吗?这是应用程序入口:

App.js

代码语言:javascript
复制
import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';
import { StackNavigator, TabNavigator } from 'react-navigation';
import { Button } from 'antd-mobile';
import C from './C';
import D from './D';

class App extends Component {

  render() {
    const { params } = this.props.navigation.state;
    return (
      <View>
        <Button onClick={() => this.props.navigation.navigate('cc')}>A页面</Button>
      </View>
    );
  }
}
class B extends React.Component {
  render() {
    return (
      <View>
        <Button onClick={() => this.props.navigation.navigate('dd')}>B页面</Button>
      </View>
    );
  }
}

const tab = TabNavigator({
  c: {
    screen: App, navigationOptions: {
      tabBarLabel: 'A',
    }
  },
  d: {
    screen: B, navigationOptions: {
      tabBarLabel: 'B'
    }
  },
});
tab.navigationOptions = {
  title: 'A和B',
};
const SimpleApp = StackNavigator({
  Home: { screen: tab },
  cc: { screen: C },
  dd: {screen: D},
});

export default SimpleApp;

这是C页代码:

C.js

代码语言:javascript
复制
 import React, { Component } from 'react';
import { List,Button } from 'antd-mobile';
import { StackNavigator, TabNavigator } from 'react-navigation';

import {
  Platform,
  StyleSheet,
  Text,
  Image,
  View
} from 'react-native';

class C extends Component {
    static navigationOptions = ({ navigation }) => ({  
        title: 'C页面',  
    }); 
  render() {
    return (
      <View>
        <Button>C页面</Button>
      </View>
    );
  }
}

export default C; 

这是D页代码:

D.js

代码语言:javascript
复制
import React, { Component } from 'react';
import { List,Button } from 'antd-mobile';
import { StackNavigator, TabNavigator } from 'react-navigation';
import E from './E';

import {
  Platform,
  StyleSheet,
  Text,
  Image,
  View
} from 'react-native';

class D extends Component {
    static navigationOptions = ({ navigation }) => ({  
        title: 'D页面', 
    });
  render() {
    return (
      <View>
        <Button onClick={()=>this.props.navigation.navigate('ee')}>D页面</Button>
      </View>
    );
  }
}
const Simple = StackNavigator({  
    dd: { screen: D },
    ee: { screen: E },  
  });
export default Simple;

这是E页代码:

E.js

代码语言:javascript
复制
import React, { Component } from 'react';
import { List,Button } from 'antd-mobile';
import { StackNavigator, TabNavigator } from 'react-navigation';

import {
  Platform,
  StyleSheet,
  Text,
  Image,
  View
} from 'react-native';

class E extends Component {
    static navigationOptions = ({ navigation }) => ({  
        title: 'E页面',  
    });
  render() {
    return (
      <View>
        <Button>E页面</Button>
      </View>
    );
  }
}

export default E;

TabNavigator和mord StackNavigator,为什么?A->C->D错误?我的配置错误发生在哪里?

EN

回答 1

Stack Overflow用户

发布于 2017-12-22 16:21:40

有headerMode选项可以添加到navigatorsOptions中,

尝试头模式:在您的子导航器中“无”

检查医生

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47944131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档