node-libs-react-native | Node core modules for React Native | Runtime Evironment library
kandi X-RAY | node-libs-react-native Summary
kandi X-RAY | node-libs-react-native Summary
Node core modules for React Native
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Buffer .
node-libs-react-native Key Features
node-libs-react-native Examples and Code Snippets
Community Discussions
Trending Discussions on node-libs-react-native
QUESTION
I am trying to put the require('node-libs-react-native/globals');
on the very top of the file, but when I save the file, it uses eslint/prettier, it is rearrange it after the import.
ANSWER
Answered 2019-Aug-19 at 21:43You could disable the import/first rule for this file to allow the 'require' statement to remain above the list of imports:
QUESTION
I am trying to use npm oxford-dictionary api in react-native, I installed "npm install oxford-dictioary" and run this file as "node app.js" on a terminal and works fine, However, when I tried to use in react native it doesn't work, can anyone help me what's is the problem. Is it possible to use this api at all with just react-native or I would have to build backend with nodejs ?
// app.js that I run on terminal var Dictionary = require("oxford-dictionary");
...ANSWER
Answered 2019-Jan-02 at 19:01Unfortunately as you have quite rightly identified you cannot use that npm package with react-native
as it does not have the https
module.
However, looking at the package oxford-dictionary
it is a single file that provides a few helper methods to construct specific network requests to the Oxford Dictionary api.
It wouldn't be too difficult to re-write these in terms of fetch
and make your own helper file. You could even create your own react-native package for the Oxford Dictionary api and publish it to npm.
With regard to accessing the Oxford Dictionary's api, there shouldn't be an issue doing it as it is just network requests. fetch
should be able to cope with it. You just won't be able to use the oxford-dictionary
npm package to make the requests.
QUESTION
First, I created a project: react-native init project
, and
when I try to import * as lightwallet from 'eth-lightwallet'
in my react-native project, I get an error see this image
Found a solution at github, but this did not solve the problem for me.
My package.json:
...ANSWER
Answered 2018-Aug-06 at 18:23The problem is that the eth-lightwallet
depends on node core modules that isn't supported by React Native out of the box. The current workaround involves using
rn-nodeify in order to provide shims for React Native to use instead. See this issue for react native and see this open issue from eth-lightwallet.
QUESTION
I want to port a number of packages written for NodeJS to React Native.
For this purpose I created a RN project using the popular Ignite boilerplate, then used the ReactNativify method and shim Node API objects mostly reusing existing browserify shims.
(For details and some useful tips see Can we use nodejs code inside react native application?)
Some Node objects are still replaced with empty mocks after transpilation, such as fs
. Done in .babelrc
as follows:
ANSWER
Answered 2017-Aug-10 at 08:48No. There is no reasonable alternative for Node's fs.readFileSync
.
Though technically it is possible to write a readFileSync
shim that blocks on an asynchronous file operation, it is inadvisable to force synchronous behavior in an asynchronous system (but you may be able to get away with it, when only having few synchronous methods in one-time initialization code).
So option 3 or 4 are the only viable alternatives.
In my case there were too many Node dependencies, so I ditched browserifying / shimming and opted for 4. But ...
That does not mean all is necessarily lost. I am now investigating Compiling NodeJS as native library in Android
(And Realm.io to bridge native NodeJS + React Native in Android fat client app (CQRS-style)).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-libs-react-native
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page