All Projects → acostalima → react-native-polyfill-globals

acostalima / react-native-polyfill-globals

Licence: MIT license
Polyfills and patches missing or partially supported web and core APIs.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-polyfill-globals

Polyfill Intl Icu
This component provides a collection of functions/classes using the symfony/intl package when the Intl extension is not installed.
Stars: ✭ 2,287 (+11335%)
Mutual labels:  polyfill
Core Js
Standard Library
Stars: ✭ 15,854 (+79170%)
Mutual labels:  polyfill
Pressure
👇💥 JavaScript library for handling Force Touch, 3D Touch, and Pointer Pressure.
Stars: ✭ 2,785 (+13825%)
Mutual labels:  polyfill
Datalist Polyfill
Minimal and dependency-free vanilla JavaScript polyfill for the awesome datalist-functionality
Stars: ✭ 197 (+885%)
Mutual labels:  polyfill
Tickedoff
Tiny library (<200B gzip) for deferring something by a "tick"
Stars: ✭ 213 (+965%)
Mutual labels:  polyfill
React Native Fetch Blob
This project was started in the cause of solving issue facebook/react-native#854, React Native's lacks of Blob implementation which results into problems when transferring binary data.
Stars: ✭ 2,593 (+12865%)
Mutual labels:  polyfill
Rangeslider.js
🎚 HTML5 input range slider element polyfill
Stars: ✭ 2,153 (+10665%)
Mutual labels:  polyfill
create-require
Polyfill for Node.js module.createRequire (<= v12.2.0)
Stars: ✭ 24 (+20%)
Mutual labels:  polyfill
Details Element Polyfill
<details>
Stars: ✭ 221 (+1005%)
Mutual labels:  polyfill
Webxr Polyfill
Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Stars: ✭ 251 (+1155%)
Mutual labels:  polyfill
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+880%)
Mutual labels:  polyfill
Xmlhttprequest
XMLHttpRequest.js - Standard-compliant cross-browser XMLHttpRequest object implementation
Stars: ✭ 211 (+955%)
Mutual labels:  polyfill
Eslint Plugin Compat
Lint the browser compatibility of your code
Stars: ✭ 2,743 (+13615%)
Mutual labels:  polyfill
Stickyfill
Polyfill for CSS `position: sticky`
Stars: ✭ 2,252 (+11160%)
Mutual labels:  polyfill
Adapter
Shim to insulate apps from spec changes and prefix differences. Latest adapter.js release:
Stars: ✭ 3,002 (+14910%)
Mutual labels:  polyfill
React Anchor Link Smooth Scroll
React component for anchor links using the smooth scroll polyfill.
Stars: ✭ 186 (+830%)
Mutual labels:  polyfill
Pagedjs
Display paginated content in the browser and generate print books using web technology
Stars: ✭ 228 (+1040%)
Mutual labels:  polyfill
es6-proxy-polyfill
ES6 Proxy polyfill, supports IE8+, Node.js, etc.
Stars: ✭ 49 (+145%)
Mutual labels:  polyfill
polyfill-useragent-normaliser
No description or website provided.
Stars: ✭ 23 (+15%)
Mutual labels:  polyfill
Poly Flif
📷 A poly-fill for the FLIF image format.
Stars: ✭ 243 (+1115%)
Mutual labels:  polyfill

react-native-polyfill-globals

npm version ci codecov

Polyfills and patches missing or partially supported web and core APIs.

Motivation

There are several APIs which React Native does not support. When available, they usally are not spec-conformant. This package aims to fill that gap by providing polyfills and patches to said APIs.

As of React Native v0.63.3:

Installation

$ npm install react-native-polyfill-globals

Peer dependencies

Install the above as necessary.

Included support

Usage

Polyfill all on demand

Import the polyfill function and call it whenever.

import { polyfill } from 'react-native-polyfill-globals';

polyfill();

Polyfill all automatically

Add the following import to the top of your app's entry file, index.js, located at the root of your project.

import 'react-native-polyfill-globals/auto';

Polyfill selectively

import { polyfill as polyfillBase64 } from 'react-native-polyfill-globals/src/base64';
import { polyfill as polyfillEncoding } from 'react-native-polyfill-globals/src/encoding';
import { polyfill as polyfillReadableStream } from 'react-native-polyfill-globals/src/readable-stream';
import { polyfill as polyfillURL } from 'react-native-polyfill-globals/src/url';
import { polyfill as polyfillFetch } from 'react-native-polyfill-globals/src/fetch';
import { polyfill as polyfillCrypto } from 'react-native-polyfill-globals/src/crypto';

Apply patches

Patch files located at the patches directory provide additional polyfills and fixes.

Apply all at once with patch-package:

$ npm install -D patch-package
$ npx patch-package --patch-dir node_modules/react-native-polyfill-globals/patches

Apply invidually with Git:

$ git apply --ignore-whitespace node_modules/react-native-polyfill-globals/react-native+0.63.3.patch

Apply invidually with patch:

$ patch -p1 -i node_modules/react-native-polyfill-globals/react-native+0.63.3.patch

⚠️ Bundling

Note that Metro, React Native's bundler, at this time does not support tree-shaking nor dead code elimination. As such, beware that even if you apply polyfills selectively and don't use them at runtime, the code will be included in the production bundle regardless. If you don't need a given polyfill, do not import it at all.

Related

  • node-libs-react-native - Node.js core modules for React Native.
  • rn-nodeify - Hack to allow React Native projects to use Node core modules and npm modules that use them.
  • ReactNativify - A saner approach on how to use Node.js libraries in React Native.

License

MIT © André Costa Lima

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].