Skip to content
Myr

Try to fix React Native support

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Sitnik · committed by Andrey Sitnik · parent b118238 · Browse files · 5 files+4 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+4 added−9 removed

  • tests:+1 added−6 removed
  • other:+3 added−3 removed

5 files+4 added−9 removed

modified:test/ie.test.js+1 added-3 removed
modified:test/index.test.js-1 removed
modified:test/react-native-polyfill.test.js-1 removed
modified:test/react-native.test.js-1 removed
modified:index.browser.js+3 added-3 removed
4 unmodified lines
5 // All bundlers will remove this block in the production bundle.6 if (7 typeof navigator !== 'undefined' &&8 navigator.product === 'ReactNative' &&9 !self.crypto9 typeof crypto === 'undefined'10 ) {11 throw new Error(12 'React Native does not have a built-in secure random generator. ' +13 'If you don’t need unpredictable IDs, you can use `nanoid/non-secure`. ' +14 'For secure IDs, import `react-native-get-random-values` before Nano ID.'15 )16 }17 if (typeof self !== 'undefined' && self.msCrypto && !self.crypto) {17 if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {18 throw new Error(19 'Add `if (!window.crypto) window.crypto = window.msCrypto` ' +20 'before Nano ID to fix IE 11 support'21 )22 }23 if (typeof self === 'undefined' || !self.crypto) {23 if (typeof crypto === 'undefined') {24 throw new Error(25 'Your browser does not have secure random generator. ' +26 'If you don’t need unpredictable IDs, you can use nanoid/non-secure.'27 )
80 unmodified lines