Remove old Expo advice
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 48b9877 · Browse files · 4 files·+6 added−28 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+6 added−28 removed
- tests:+1 added−1 removed
- other:+5 added−27 removed
Provenance
- Commit
77d929e- Tree
988e311- Author
Andrey Sitnik <andrey@sitnik.ru>- Committer
Andrey Sitnik <andrey@sitnik.ru>- Parent
48b9877
4 files changed+6 added−28 removed
modified:test/async.test.js+1 added-1 removed
133 unmodified linesExpand all13413513613713813813914014114223 unmodified lines133 unmodified linesExpand all })
it('has flat distribution', async () => { let COUNT = 50 * 1000 let LENGTH = 10 let LENGTH = 30 let ALPHABET = 'abcdefghijklmnopqrstuvwxy' let nanoid2 = customAlphabet(ALPHABET, LENGTH)
let chars = {}23 unmodified linesmodified:index.browser.js+1 added-2 removed
12 unmodified lines13 throw new Error(14 'React Native does not have a built-in secure random generator. ' +15 'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +16 'For secure IDs, import `react-native-get-random-values` ' +17- 'before Nano ID. If you use Expo v38 or below, install `expo-random` ' +18- 'and use `nanoid/async`.'17+ 'before Nano ID.'18 )19 }20 if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {21 throw new Error(83 unmodified linesmodified:package.json+2 added-3 removed
72 unmodified lines73 },74 {75 "name": "customAlphabet",76 "import": "{ customAlphabet }",77- "limit": "142 B"77+ "limit": "141 B"78 },79 {80 "name": "urlAlphabet",81 "import": "{ urlAlphabet }",105 unmodified lines187 "Rollup",188 "transpile",189 "workaround",190 "Deno",191- "polyfill",192- "v39"191+ "polyfill"192 ]193 },194 "sharec": {195 "config": "@logux/sharec-config",3 unmodified linesmodified:README.md+2 added-22 removed
45 unmodified lines46 * [React](#react)47 * [Create React App](#create-react-app)48 * [React Native](#react-native)49 * [Rollup](#rollup)50- * [Expo](#expo)50 * [PouchDB and CouchDB](#pouchdb-and-couchdb)51 * [Mongoose](#mongoose)52 * [ES Modules](#es-modules)53 * [Web Workers](#web-workers)179 unmodified lines233 234 235 ### React Native236 238-React Native does not have built-in random generator. The following polyfill works for plain React239-Native and Expo starting with v39.237+React Native does not have built-in random generator. The following polyfill238+works for plain React Native and Expo starting with `39.x`.239 240 1. Check [`react-native-get-random-values`] docs and install it.241 2. Import it before Nano ID.242 22 unmodified lines265 266 [`@rollup/plugin-replace`]: https://github.com/rollup/plugins/tree/master/packages/replace267 268 270-### Expo271-272-If you use Expo prior to v39 in React Native, you need a different workaround.273-274-1. Install [`expo-random`](https://www.npmjs.com/package/expo-random).275-2. Use `nanoid/async` instead of `nanoid`.276-3. Import `index.native.js` file directly.277-278-```js279-import { nanoid } from 'nanoid/async/index.native'280-281-async function createUser () {282- user.id = await nanoid()283-}284-```285-286-[`expo-random`]: https://www.npmjs.com/package/expo-random287-288-269 ### PouchDB and CouchDB270 271 In PouchDB and CouchDB, IDs can’t start with an underscore `_`.272 A prefix is required to prevent this issue, as Nano ID might use a `_`212 unmodified lines