From 5cfe877ef1b8f761a7dd63c3c0c7e9479e1baa0a Mon Sep 17 00:00:00 2001 From: Rohit Singh Date: Wed, 9 Oct 2024 16:41:01 +0530 Subject: [PATCH] feat: v1 localstorage polyfill --- README.md | 14 ++++++-------- example/src/App.tsx | 1 + lefthook.yml | 4 ++-- tsconfig.json | 11 ++++++++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d37a0de..3e02c0b 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,18 @@ npm install react-native-localstorage-polyfill ## Usage +Simply import react-native-localstorage-polyfill in the root of your app ```js -import { multiply } from 'react-native-localstorage-polyfill'; +import 'react-native-localstorage-polyfill'; +``` -// ... +```js +localStorage.setItem('key', 'value'); -const result = await multiply(3, 7); +localStorage.getItem('key'); ``` - ## Contributing See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. @@ -27,7 +29,3 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the ## License MIT - ---- - -Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) diff --git a/example/src/App.tsx b/example/src/App.tsx index 2fe90e4..12878e1 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,3 +1,4 @@ +// @ts-nocheck import { StyleSheet, View, Text } from 'react-native'; export default function App() { diff --git a/lefthook.yml b/lefthook.yml index 9695c12..eb71c86 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -2,10 +2,10 @@ pre-commit: parallel: true commands: lint: - glob: "*.{js,ts,jsx,tsx}" + glob: '*.{js,ts,jsx,tsx}' run: npx eslint {staged_files} types: - glob: "*.{js,ts, jsx, tsx}" + glob: '*.{js,ts, jsx, tsx}' run: npx tsc commit-msg: parallel: true diff --git a/tsconfig.json b/tsconfig.json index a581bae..edc61dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,14 +2,19 @@ "compilerOptions": { "rootDir": ".", "paths": { - "react-native-localstorage-polyfill": ["./src/index"] + "react-native-localstorage-polyfill": [ + "./src/index" + ] }, "allowUnreachableCode": false, "allowUnusedLabels": false, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "jsx": "react-jsx", - "lib": ["ESNext"], + "lib": [ + "ESNext", + "DOM" + ], "module": "ESNext", "moduleResolution": "Bundler", "noEmit": true, @@ -26,4 +31,4 @@ "target": "ESNext", "verbatimModuleSyntax": true } -} +} \ No newline at end of file