小编con*_*nor的帖子

从 Drawer Navigator 导航到特定选项卡

是否可以将 Tab Navigator 嵌套在 Drawer Navigator 中,然后从 Drawer 导航到特定选项卡?

考虑这个非常基本的设置:

const PrimaryNav = createBottomTabNavigator({
  ScreenOne,
  ScreenTwo
 })

export const DrawerNavigator = createDrawerNavigator({
  Home: {
    screen: PrimaryNav,
    drawerLabel: 'Option 1',
  },
  Investment: {
    screen: PrimaryNav,
    drawerLabel: 'Option 2',
  }
})
Run Code Online (Sandbox Code Playgroud)

显然,无论您单击哪个选项,此设置都将解析为 TabNav 中的第一项。

有没有办法传递一个选项来专门导航到每个选项卡?我知道可以将 ScreenOne 和 ScreenTwo 传递给 DrawerNavigator 中的“屏幕”选项,但我想保留选项卡。

react-native react-navigation

3
推荐指数
1
解决办法
3678
查看次数

同时利用 GraphQL 和 Mongoose

是否可以同时利用 GraphQL 和 Mongoose?

到目前为止,我已经能够集成 GraphQL 和 Mongoose 来处理数据库填充,但我很难理解它如何检索数据,特别是具有嵌套引用的数据。

考虑这个模式:

const fooSchema = new Schema({
  name: { type: 'String', required: true },
  bar: [{
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Bar',
    required: false,
  }],
});
Run Code Online (Sandbox Code Playgroud)

Bar 模式本质上是相同的,只有一个“name”字段。

是否可以运行 GraphQL 查询来使用“bar”中的引用填充数据?

目前,我们正在使用 GraphQL-Tools 来创建 typeDefs、Mutations 和 Queries,如下所示:

const typeDefs = `
  type Foo {
    name: String!,
    bars:[Bar] 
  }
  type Bar {
    _id: ID,
    name: String,
  }

  type Query {
    allFoos: [Foo!]!
    foo(_id: ID!): Foo
  }

  type Mutation {
    ...
  }
`;
module.exports = makeExecutableSchema({typeDefs, …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js graphql graphql-js

1
推荐指数
1
解决办法
1114
查看次数