File tree Expand file tree Collapse file tree 10 files changed +626
-32
lines changed Expand file tree Collapse file tree 10 files changed +626
-32
lines changed Original file line number Diff line number Diff line change 1+ version : 2
2+
3+ # Defaults
4+ default job config : &defaults
5+ working_directory : ~/async_storage
6+ docker :
7+ - image : circleci/node:8
8+
9+ checkout step for each job : &addWorkspace
10+ attach_workspace :
11+ at : ~/
12+
13+
14+ jobs :
15+ " Setup environment " :
16+ << : *defaults
17+ steps :
18+ - checkout
19+ - restore_cache :
20+ name : Restore node modules
21+ keys :
22+ - node_modules-{{ checksum "yarn.lock" }}-{{ checksum "package.json" }}-{{ arch }}
23+ - run :
24+ name : Install dependencies
25+ command : yarn --pure-lockfile --non-interactive
26+ - save_cache :
27+ name : Save node modules
28+ key : node_modules-{{ checksum "yarn.lock" }}-{{ checksum "package.json" }}-{{ arch }}
29+ paths :
30+ - node_modules
31+ persist_to_workspace :
32+ -root : .
33+ -paths : .
34+
35+ " Test: lint " :
36+ << : *defaults
37+ steps :
38+ - *addWorkspace
39+ - run :
40+ name : Lint check
41+ command : yarn test:lint
42+
43+ " Test: flow " :
44+ << : *defaults
45+ steps :
46+ - *addWorkspace
47+ - run :
48+ name : Flow check
49+ command : yarn test:flow
50+
51+ workflows :
52+ version : 2
53+ " Basic check " :
54+ jobs :
55+ - " Setup environment"
56+ - " Test: lint " :
57+ requires :
58+ - " Setup environment"
59+ - " Test: flow " :
60+ requires :
61+ - " Setup environment"
Original file line number Diff line number Diff line change 55
66 "env": {
77 "es6": true,
8+ "jest/globals": true
89 },
910
1011 "plugins": [
1415 "react",
1516 "react-hooks",
1617 "react-native",
17- "jest",
18+ "jest"
1819 ],
1920
2021 // Map from global var to bool specifying if it can be redefined
5051 "setInterval": false,
5152 "setTimeout": false,
5253 "window": false,
53- "XMLHttpRequest": false,
54+ "XMLHttpRequest": false
5455 },
5556
5657 "rules": {
Original file line number Diff line number Diff line change 1- # react-native-async-storage
1+ # React Native Async Storage
22
3- Asynchronous , persistent, key-value storage system for React Native.
3+ An asynchronous , persistent, key-value storage system for React Native.
44
5- ## Getting started
65
6+ ## Getting Started
77
8- ### Install
98
10- ` yarn add @react-native-community/async-storage `
9+ ```
10+ # Install
11+ $ yarn add @react-native-community/async-storage
1112
12- or
13+ # Link
14+ $ react-native link @react-native-community/async-storage
15+ ```
1316
14- ` npm install @react-native-community/async-storage --save `
17+ See docs for [ manual linking guide. ] ( docs/Linking.md )
1518
1619
17- ### Link
20+ ## Usage
1821
19- ` react-native link @react-native-community/async-storage `
22+ ### Import
2023
21- ## Usage
24+ ``` js
25+ import AsyncStorage from ' @react-native-community/async-storage' ;
26+ ```
27+
28+ ### Store data
29+ ``` jsx
30+
31+ storeData = async () => {
32+ try {
33+ await AsyncStorage .setItem (' @storage_Key' , ' stored value' )
34+ } catch (e) {
35+ // saving error
36+ }
37+ }
38+
39+ ```
40+
41+ ### Read data
42+ ``` jsx
43+
44+ getData = async () => {
45+ try {
46+ const value = await AsyncStorage .getItem (' @storage_Key' )
47+ if (value !== null ) {
48+ // value previously stored
49+ }
50+ } catch (e) {
51+ // error reading value
52+ }
53+ }
54+
55+ ```
56+
57+ See docs for [ api and more examples.] ( docs/API.md )
2258
23- ToDo
59+ ## License
2460
61+ MIT
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = {
55 'module-resolver' ,
66 {
77 alias : {
8- '@react-native-community/asyns -storage' : './lib/AsyncStorage' ,
8+ '@react-native-community/async -storage' : './lib/AsyncStorage' ,
99 } ,
1010 cwd : 'babelrc' ,
1111 } ,
You can’t perform that action at this time.
0 commit comments