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 5
5
6
6
"env": {
7
7
"es6": true,
8
+ "jest/globals": true
8
9
},
9
10
10
11
"plugins": [
14
15
"react",
15
16
"react-hooks",
16
17
"react-native",
17
- "jest",
18
+ "jest"
18
19
],
19
20
20
21
// Map from global var to bool specifying if it can be redefined
50
51
"setInterval": false,
51
52
"setTimeout": false,
52
53
"window": false,
53
- "XMLHttpRequest": false,
54
+ "XMLHttpRequest": false
54
55
},
55
56
56
57
"rules": {
Original file line number Diff line number Diff line change 1
- # react-native-async-storage
1
+ # React Native Async Storage
2
2
3
- Asynchronous , persistent, key-value storage system for React Native.
3
+ An asynchronous , persistent, key-value storage system for React Native.
4
4
5
- ## Getting started
6
5
6
+ ## Getting Started
7
7
8
- ### Install
9
8
10
- ` yarn add @react-native-community/async-storage `
9
+ ```
10
+ # Install
11
+ $ yarn add @react-native-community/async-storage
11
12
12
- or
13
+ # Link
14
+ $ react-native link @react-native-community/async-storage
15
+ ```
13
16
14
- ` npm install @react-native-community/async-storage --save `
17
+ See docs for [ manual linking guide. ] ( docs/Linking.md )
15
18
16
19
17
- ### Link
20
+ ## Usage
18
21
19
- ` react-native link @react-native-community/async-storage `
22
+ ### Import
20
23
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 )
22
58
23
- ToDo
59
+ ## License
24
60
61
+ MIT
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = {
5
5
'module-resolver' ,
6
6
{
7
7
alias : {
8
- '@react-native-community/asyns -storage' : './lib/AsyncStorage' ,
8
+ '@react-native-community/async -storage' : './lib/AsyncStorage' ,
9
9
} ,
10
10
cwd : 'babelrc' ,
11
11
} ,
You can’t perform that action at this time.
0 commit comments