React Native Web:如何找到兼容的包?

React Native Web: How to find compatible packages?

我有一些关于 React Native Web 的问题。我还没有真正了解它是如何工作的,所以我希望得到一些答案。

所以一般来说,我如何在 React Native Web 中进行开发?我需要知道如何移植 npm 包以便我可以使用它们。

非常感谢任何建议!

Exactly, what happens when we "alias" the React Native to Web?

这意味着库 react-native-web 会将 react-native 组件转换为 HTML/CSS 标签。

举个例子:

<View> <Text style={{color: 'red'}}>I'm an awesome text</Text> </View>

在浏览器上渲染时会变成:

<div> <span style="color: red">I'm an awesome text</span> </div>

When working with Expo, why isn't some packages available? For example, the LinearGradient get's an error saying it can't be found.

Expo 提供了一种非常简单的方法来开始开发 React Native 应用程序。但它是一个封闭的盒子,你不能在其中添加社区原生包,只能添加 Expo 自带的原生包。有一个例外,js-only 包,如:https://github.com/crazycodeboy/react-native-check-box

对于原生包,您需要在应用程序的原生端 link 并编译它们。为此,我建议您从本机开发开始,您可以在此处找到路径:https://facebook.github.io/react-native/docs/getting-started#the-react-native-cli

I want to use Netlify Identity Widget, but that renders in HTML. How do I use that with React Native Web?

您可以使用任何呈现 HTML 的 package/widget/library,因为您将在浏览器上 运行 它。您只需输入 yarn add netlify-identity-widget 即可开始使用它 或 npm install netlify-identity-widget --save 进入你的 react-native-web 根文件夹。

希望我有所帮助!