react-native-global-state-hooks 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # react-native-global-state-hooks
2
- This is a package to easily handling global-state across your react-native-components No-redux, No-context.
2
+ This is a package to easily handling global-state across your react-native-components **No-redux**.
3
3
 
4
- This utility follows the same style as the default useState hook, this in order to be an intuitive and easy to use
4
+ This utility follows the same style as the default **useState** hook, with a subscription pattern and HOFs to create a more intuitive, atomic and easy way of sharing state between components
5
5
 
6
6
  **after version 1.0.4, we migrated to @react-native-async-storage/async-storage, because @react-native-async-storage/async-storage has been deprecated!!**
7
7
 
@@ -10,90 +10,110 @@ This utility follows the same style as the default useState hook, this in order
10
10
  We are gonna create a global count example **useCountGlobal.ts**:
11
11
 
12
12
  ```JSX
13
+ // Import the store costructor
13
14
  import GlobalStore from 'react-native-global-state-hooks';
14
15
 
16
+ // initialize your store with the default value of the same.
15
17
  const countStore = new GlobalStore(0);
16
18
 
19
+ // youll use this function the same way you'll use the **useState**
17
20
  export const useCountGlobal = countStore.getHook();
18
- ```
19
21
 
20
- That's it, that's a global store... Strongly typed, with a global-hook that we could reuse cross all our react-components.
22
+ // That's it, that's a global store... Strongly typed, with a global-hook that we could reuse cross all our react-components.
23
+ ```
21
24
 
22
- ## Consuming global hook
25
+ ## Implementing your global hook into your components
23
26
  Let's say we have two components **Stage1**, **Stage2**, in order to use our global hook they will look just like:
27
+
24
28
  ```JSX
25
29
  import { useCountGlobal } from './useCountGlobal'
26
30
 
27
- const Stage1: React.FC = () => {
31
+ const MyFirstComponent: React.FC = () => {
28
32
  const [count, setter] = useCountGlobal();
29
33
  const onClickAddOne = () => setter(count + 1);
30
34
 
31
35
  return (<button onPress={onClickAddOne}>count: {count}<button/>);
32
36
  }
33
37
 
34
- const Stage2: React.FC = () => {
38
+ const MySecondComponent: React.FC = () => {
35
39
  const [count, setter] = useCountGlobal();
36
40
  const onClickAddTwo = () => setter(count + 2);
37
41
 
38
42
  return (<button onPress={onClickAddTwo}>count: {count}<button/>);
39
43
  }
40
- ```
41
44
 
42
- Just like that! You now are using a global state.
45
+ // Just like that! You are now using a global state!!
46
+ ```
43
47
 
44
48
  Note that the only difference between this and the default **useState** hook is that you are not adding the initial value, cause you already did that when you created the store:
49
+
45
50
  ```JSX
46
51
  const countStore = new GlobalStore(0);
47
52
  ```
48
53
 
49
54
  ## Persisted store
50
55
 
51
- You could persist the state in the **async-storage** by just adding the **key-name** to the constructor of your global-store, for example:
56
+ You could persist the state with **@react-native-async-storage** by just adding the **key-name** to the constructor of your global-store, for example:
57
+
52
58
  ```JSX
53
59
  // The FIRST parameter is the initial value of the state
54
60
  // The Second parameter is an API to restrict access to the state, will talk about that later.
55
- // The Third parameter is the key that will use on the async-storage
61
+ // The Third parameter is the key that will be used on the async-storage
56
62
  const countStore = new GlobalStore(0, null, 'GLOBAL_COUNT');
57
63
  ```
58
64
 
59
65
  ## Consuming Persisted Store
60
66
 
61
67
  ```JSX
62
- const [count, setCount, isCountUpdated] = useCountGlobal();
68
+ const MyComponent: React.FC = () => {
69
+ // connect the component to the global persisted storage
70
+ const [count, setCount, isCountReady] = useCountGlobal();
71
+ const onClickAddOne = () => setCount(count + 1);
72
+
73
+ /**
74
+ * since the async storage is ASYNC, the first time the hook is called into a component we may get the default value, instead of the one from the storage.
75
+ *
76
+ * We are able to validate this with the third value returned in the hook array **isCountReady**, which is a boolean which let us now if the async storage already was reached out.
77
+ */
78
+ const countLabel = isCountReady ? `count: ${count}` : 'Loading async storage...';
79
+
80
+ return (<button onPress={onClickAddOne}>{countLabel}<button/>);
81
+ }
63
82
  ```
64
83
 
65
- **isCountUpdated**: With the persist storage, the first time the hooks is called the same is gonna return the default value declared in the **new GlobalStore**, at the same time will perform an **async** request to the **async-storage** in order to get the stored value, to validate if that call was already performed, youl'll get an extra boolean value.
66
-
67
84
  ## Decoupled hook
68
85
 
86
+ If you want to access the global state outside a component or outside a hook, or without subscribing the component to the state changes...
87
+
88
+ This is especially useful when you want to create components that have edition access to a certain store, but they actually don't need to be reactive to the state changes, like a search component that just need to get the current state every time that is going to search the data; but actually don't need to be subscribed to the changes over the collection he is going to be filtering.
89
+
90
+
69
91
  ```JSX
70
92
  import GlobalStore from 'react-native-global-state-hooks';
71
93
 
72
94
  const countStore = new GlobalStore(0);
73
95
 
96
+ // remember this should be used as the **useState** hook.
74
97
  export const useCountGlobal = countStore.getHook();
75
98
 
99
+ // this functions are not hooks, and they can be used in whatever place into your code, ClassComponents, OtherHooks, Services etc.
76
100
  export const [getCountGlobalValue, setCountGlobalValue] = countStore.getHookDecoupled();
77
101
 
78
102
  ```
79
103
 
80
- If you want to access the global state outside a component or outside a hook, or without subscribing the component to the state changes...
81
-
82
- This is especially useful when you want when you create components that have edition access to a certain store, but they actually don't need to be reactive to the state changes, like a search component that just need to get the current state every time that is going to search the data; but actually don't need to be subscribed to the changes over the collection he is going to be filtering.
83
-
84
-
85
104
  Let's see a trivial example:
105
+
86
106
  ```JSX
87
107
  import { useCountGlobal, setCountGlobalValue } from './useCountGlobal'
88
108
 
89
- const Stage1: React.FC = () => {
109
+ const CountDisplayerComponent: React.FC = () => {
90
110
  const [count] = useCountGlobal();
91
111
 
92
112
  return (<label>{count}<label/><br/>);
93
113
  }
94
114
 
95
115
  // Stage2 does not need to be updated once the global count changes
96
- const Stage2: React.FC = () => {
116
+ const CountManagerComponent: React.FC = () => {
97
117
  const increaseClick = () => setCountGlobalValue(count => count + 1);
98
118
  const decreaseClick = () => setCountGlobalValue(count => count - 1);
99
119
 
@@ -106,8 +126,9 @@ const Stage2: React.FC = () => {
106
126
 
107
127
  ## Advantages:
108
128
  1. Using REACT's simplest and default way to deal with the state.
109
- 2. This library also is taking care of batching multiple stores updates by using **React unstable_batchedUpdates**; this is a problem that the **useState** have when you call multiple **setStates** into async flows as setTimeout
110
129
  3. This tool also take care for you to avoid **async-storage*** data to lose the data types that you stored. For example when you are using datetimes
111
130
 
112
131
  ## Advance Config
113
- [README]: ./README.advance.md
132
+
133
+ Here you can see more information how to create more complex services for your global stores.
134
+ [README]:./README.advance.md
@@ -27,9 +27,12 @@ export declare class GlobalStore<IState, IPersist extends string | null = null,
27
27
  */
28
28
  protected static batchedUpdates: [() => void, object][];
29
29
  protected globalSetter: (setter: IState | ((state: IState) => IState), callback: () => void) => void;
30
- protected globalSetterAsync: (setter: IState | ((state: IState) => IState)) => Promise<void>;
31
- protected globalSetterToPersistStoreAsync: (setter: IState | ((state: IState) => IState)) => Promise<void>;
30
+ protected globalSetterAsync: (setter: IState | ((state: IState) => IState)) => Promise<IState>;
31
+ protected globalSetterToPersistStoreAsync: (setter: IState | ((state: IState) => IState)) => Promise<IState>;
32
32
  static ExecutePendingBatchesCallbacks: (() => void)[];
33
+ /**
34
+ * React native cannot use unstable_batchedUpdates, it does not have any effect
35
+ */
33
36
  static ExecutePendingBatches: import("lodash").DebouncedFunc<() => void>;
34
37
  protected getActions: <IApi extends IGlobalStore.ActionCollectionResult<IState, IGlobalStore.IActionCollectionConfig<IState>>>() => IApi;
35
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalStore.d.ts","sourceRoot":"","sources":["../src/GlobalStore.ts"],"names":[],"mappings":";AAMA,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAEnD,eAAO,MAAM,WAAW,0BAAuH,CAAC;AAEhJ,qBAAa,WAAW,CACtB,MAAM,EACN,QAAQ,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,EACrC,SAAS,SAAS,OAAO,GAAG,QAAQ,SAAS,IAAI,GAAG,KAAK,GAAG,IAAI,EAChE,QAAQ,SAAS,YAAY,CAAC,uBAAuB,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAC3E,YAAW,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;IAQ/D,SAAS,CAAC,KAAK,EAAE,M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AQtB;IAEN,SAAS,CAAC,UAAU,qHA0BlB;CAEH;AAED,eAAe,WAAW,CAAC"}
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = require("react");
6
6
  const lodash_1 = require("lodash");
7
7
  const async_storage_1 = (0, tslib_1.__importDefault)(require("@react-native-async-storage/async-storage"));
8
- const react_dom_1 = (0, tslib_1.__importDefault)(require("react-dom"));
9
8
  const isPrimitive = (value) => (0, lodash_1.isNil)(value) || (0, lodash_1.isNumber)(value) || (0, lodash_1.isBoolean)(value) || (0, lodash_1.isString)(value) || typeof value === 'symbol';
10
9
  exports.isPrimitive = isPrimitive;
11
10
  class GlobalStore {
@@ -59,10 +58,11 @@ class GlobalStore {
59
58
  GlobalStore.ExecutePendingBatchesCallbacks.push(callback);
60
59
  GlobalStore.ExecutePendingBatches();
61
60
  };
62
- this.globalSetterAsync = (setter) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { return new Promise((resolve) => this.globalSetter(setter, () => resolve())); });
61
+ this.globalSetterAsync = (setter) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { return new Promise((resolve) => this.globalSetter(setter, () => resolve(this.state))); });
63
62
  this.globalSetterToPersistStoreAsync = (setter) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
64
63
  yield this.globalSetterAsync(setter);
65
64
  yield this.setAsyncStoreItem();
65
+ return this.state;
66
66
  });
67
67
  this.getActions = () => {
68
68
  const actions = this.actions;
@@ -173,17 +173,15 @@ exports.GlobalStore = GlobalStore;
173
173
  */
174
174
  GlobalStore.batchedUpdates = [];
175
175
  GlobalStore.ExecutePendingBatchesCallbacks = [];
176
- // avoid multiples calls to batchedUpdates
177
- // eslint-disable-next-line @typescript-eslint/no-empty-function
176
+ /**
177
+ * React native cannot use unstable_batchedUpdates, it does not have any effect
178
+ */
178
179
  GlobalStore.ExecutePendingBatches = (0, lodash_1.debounce)(() => {
179
- const reactBatchedUpdates = react_dom_1.default.unstable_batchedUpdates || ((mock) => mock());
180
- reactBatchedUpdates(() => {
181
- GlobalStore.batchedUpdates.forEach(([execute]) => {
182
- execute();
183
- });
184
- GlobalStore.batchedUpdates = [];
185
- GlobalStore.ExecutePendingBatchesCallbacks.forEach((callback) => callback());
186
- GlobalStore.ExecutePendingBatchesCallbacks = [];
180
+ GlobalStore.batchedUpdates.forEach(([execute]) => {
181
+ execute();
187
182
  });
183
+ GlobalStore.batchedUpdates = [];
184
+ GlobalStore.ExecutePendingBatchesCallbacks.forEach((callback) => callback());
185
+ GlobalStore.ExecutePendingBatchesCallbacks = [];
188
186
  }, 0);
189
187
  exports.default = GlobalStore;
@@ -2,7 +2,7 @@
2
2
  * @param {StateSetter<IState>} setter - add a new value to the state
3
3
  * @returns {void} result - void
4
4
  */
5
- export declare type StateSetter<IState> = (setter: IState | ((state: IState) => IState)) => void;
5
+ export declare type StateSetter<IState> = (setter: IState | ((state: IState) => IState)) => Promise<IState>;
6
6
  /**
7
7
  * This is the structure required by the API actions in order to be able to capture action parameters and inject state setter into actions.
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalStoreTypes.d.ts","sourceRoot":"","sources":["../src/GlobalStoreTypes.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF,oBAAY,WAAW,CAAC,MAAM,IAAI,CAChC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,KACzC,IAAI,CAAC;AAEV;;EAEE;AACF,oBAAY,aAAa,CAAC,MAAM,IAAI,CAElC,GAAG,MAAM,EAAE,GAAG,EAAE,KACb,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7E;;EAEE;AACF,MAAM,WAAW,uBAAuB,CAAC,MAAM;IAC7C,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;CACtC;AAED;;EAEE;AACF,MAAM,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KAAK,GAAG,IAAI,EAChE,QAAQ,SAAS,uBAAuB,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI;IAG9D,cAAc,EAAE,QAAQ,CAAC;IAEzB,cAAc,EAAE,OAAO,CAAC;IAExB;;;MAGE;IACF,OAAO,EAAE,CAAC,IAAI,SAAS,QAAQ,SAAS,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO,MAAM;QAC7I,MAAM;QACN,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;QACnC,SAAS,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI;KACxC,CAAC;IAEF;;;;MAIE;IACF,gBAAgB,EAAE,CAAC,IAAI,SAAS,QAAQ,SAAS,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO;QAChJ,MAAM,QAAQ,SAAS,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;QACxD,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;KACpC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAClC,MAAM,EACN,QAAQ,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,EACrC,SAAS,SAAS,OAAO,GAAG,QAAQ,SAAS,IAAI,GAAG,KAAK,GAAG,IAAI,EAChE,QAAQ,SAAS,uBAAuB,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAC9D,SAAQ,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAE5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-global-state-hooks",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "This is a package to easily handling global-state across your react-native-components No-redux",
5
5
  "main": "lib/GlobalStore.js",
6
6
  "files": [
@@ -61,13 +61,6 @@
61
61
  "peerDependencies": {
62
62
  "@react-native-async-storage/async-storage": "workspace:*",
63
63
  "lodash": "workspace:*",
64
- "react": "workspace:*",
65
- "react-dom": "workspace:*"
66
- },
67
- "dependencies": {
68
- "@react-native-async-storage/async-storage": "^1.15.14",
69
- "lodash": "^4.17.21",
70
- "react": "^17.0.2",
71
- "react-dom": "^17.0.2"
64
+ "react": "workspace:*"
72
65
  }
73
66
  }