简体   繁体   English

是否可以在 React-Native 中使用 React 库?

[英]Is it possible to use React libraries in React-Native?

Recently I started working on React-Native, earlier I used to work on React, as I'm new to it I am struggling to work on many requirements for example the drag/drop among two lists which actually is pretty simple while using HTML/React but it's so complex in React-Native, there's no library to support the feature and i never of such struggle, is there a way I can use any React library in React-Native or can anyone help me with React-Native library where I can use Draggable Flatlists to drag among each other as well as having the option to move it to the other list.最近我开始在 React-Native 上工作,之前我曾经在 React 上工作,因为我是新手,我正在努力处理许多需求,例如两个列表之间的拖放,这在使用 HTML 时实际上非常简单/ React 但它在 React-Native 中非常复杂,没有支持该功能的库,我从来没有遇到过这样的困难,有没有办法可以在 React-Native 中使用任何 React 库,或者任何人都可以帮助我使用 React-Native 库可以使用 Draggable Flatlists 在彼此之间拖动,也可以选择将其移动到另一个列表。

I'm struggling with this requirement for last weeks and had googled a lot.过去几周我一直在为这个要求而苦苦挣扎,并且在谷歌上搜索了很多。

Tried some React-Native libraries as well but it didn't work.也尝试了一些 React-Native 库,但没有奏效。

react library actually does not have anything related to Browser DOM HTML . react 库实际上没有任何与Browser DOM HTML相关的东西。 Anything related to it separated into react-dom package.与它相关的任何内容都分离到react-dom包中。 React Native does not and cannot use this library, because you don't have DOM underneath a react native application. React Native没有也不能使用这个库,因为在React Native应用程序下面没有 DOM。 However you can use most of the code/functionality you wrote for your mobile app in the browser, if you install necessary transpiling library.但是,如果您安装了必要的转译库,您可以在浏览器中使用您为移动应用编写的大部分代码/功能。 This is possible because react native defines some primitive components that can be ported to almost any platform.这是可能的,因为 react native 定义了一些可以移植到几乎任何平台的原始组件。 If you still want to use just HTML to render inside react native, you may use WebView for it.如果您仍然想仅使用 HTML 在 React Native 内部呈现,您可以使用WebView

this is a great explanation by iamwebgeek user.这是 iamwebgeek 用户的一个很好的解释。 hope it helps希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM