使用 Relay Modern 创建-react-native-app / expo

Posted

技术标签:

【中文标题】使用 Relay Modern 创建-react-native-app / expo【英文标题】:create-react-native-app / expo with Relay Modern 【发布时间】:2017-10-21 14:12:50 【问题描述】:

我们可以在 Expo 中使用 Relay Modern 吗?

在https://docs.expo.io/versions/v17.0.0/guides/using-graphql.html 的文档中,只提到了 Apollo 客户端。

【问题讨论】:

【参考方案1】:

是的,这是可能的,我正在将它用于我的一个项目并且效果很好......

虽然,它得到了一点警告

警告:“react-relay”的安装版本 1.0.0-rc.4 不 满足需要的版本开发

但它仍然会很好地运行,只是要注意 android 部分它可能无法在其上运行,但是这个线程给出了解决方案

https://github.com/facebook/relay/issues/1704#issuecomment-297982006

【讨论】:

嗨@Bondan,您是否有更多关于您如何使用中继现代 api 很好地获得世博会的信息? 是的,如果你有时间的话,如果你有更多关于你如何让它工作的信息,那就太好了。我正在尝试,但收到我在这里报告的错误forums.expo.io/t/…The package at "node_modules/babel-plugin-relay/lib/getDocumentName.js" attempted to import the Node standard library module "path". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq.html#can-i-use-nodejs-packages-with-expo

以上是关于使用 Relay Modern 创建-react-native-app / expo的主要内容,如果未能解决你的问题,请参考以下文章

带有 Babel 问题的 React/Relay Modern/GraphQL 简单项目设置

在网络环境中收到 401 错误时 React Relay Modern 重定向到另一个页面

如何使用 Relay Modern 突变进行文件上传?

如何处理 Relay Modern 上的突变错误?

在 Relay Modern 中设置多个网络层

Relay Modern 节点不包含片段属性