为什么在React-Native显示堆栈导航头中创建容器meteor调用?

时间:2022-06-04 19:39:58

I am using StackNavigator from 'react-navigation' to control navigation and Meteor to fetch data. In order to remove default navigation header, I wrote this static navigationOptions = { header: null};. It works fine with static data. But whenever I am calling createContainer() function to collect data, that component displays default white header above my custom header. Can anyone show me what am I missing? Thanks in advance!

我正在使用来自“react-navigation”的StackNavigator控制导航,使用Meteor来获取数据。为了删除默认导航标题,我写了这个静态navigationOptions = {header:null};。它适用于静态数据。但每当我调用createContainer()函数来收集数据时,该组件会在我的自定义标题上方显示默认的白色标题。谁能告诉我我错过了什么?提前致谢!

1 个解决方案

#1


0  

You can get it working by moving static navigationOptions out of the class. For example you can save created container in variable

您可以通过将静态navigationOptions移出类而使其工作。例如,您可以将创建的容器保存在变量中

const container = createContainer(() => {
  Meteor.subscribe('somedata')
    return {
    data: Meteor.data()
  }
}, YourClass)

and attach navigationOptions to it:

并将navigationOptions附加到它:

 container.navigationOptions = { header: null}

and export that new container with attached navigationOptions

并导出具有附加navigationOptions的新容器

export default container

#1


0  

You can get it working by moving static navigationOptions out of the class. For example you can save created container in variable

您可以通过将静态navigationOptions移出类而使其工作。例如,您可以将创建的容器保存在变量中

const container = createContainer(() => {
  Meteor.subscribe('somedata')
    return {
    data: Meteor.data()
  }
}, YourClass)

and attach navigationOptions to it:

并将navigationOptions附加到它:

 container.navigationOptions = { header: null}

and export that new container with attached navigationOptions

并导出具有附加navigationOptions的新容器

export default container