react-native-global-state-hooks 6.0.5 → 6.0.7
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
|
@@ -16,7 +16,7 @@ You can explore a **TODO-LIST** example using global state and asynchronous stor
|
|
|
16
16
|
|
|
17
17
|
For a more visual introduction, watch our informative video [here!](https://www.youtube.com/watch?v=1UBqXk2MH8I) 🎥 and dive into the code on [global-hooks-example](https://github.com/johnny-quesada-developer/global-hooks-example) 🧩.
|
|
18
18
|
|
|
19
|
-
The best part?
|
|
19
|
+
The best part? [react-hooks-global-states](https://www.npmjs.com/package/react-hooks-global-states) is compatible with both **React** and **React Native**. If you're building web applications, explore this [react-global-state-hooks](https://www.npmjs.com/package/react-global-state-hooks), and for your React Native projects, here you are at **react-native-global-state-hooks**. These specialized libraries extend the capabilities of [react-hooks-global-states](https://www.npmjs.com/package/react-hooks-global-states) to perfectly fit your specific development environments. Discover the ease of global state management today! 🌐
|
|
20
20
|
|
|
21
21
|
# Creating a global state
|
|
22
22
|
|
|
@@ -92,7 +92,7 @@ export type ActionCollectionResult<TState, TMetadata, TStateSetter extends Actio
|
|
|
92
92
|
* @template {TStateSetter} TStateSetter - The storeActionsConfig type (optional) - if you pass an storeActionsConfig the hook will return an object with the actions
|
|
93
93
|
* @template {ActionCollectionResult<TState, TStateSetter>} TStateSetter - the result of the API (optional) - if you don't pass an API as a parameter, you can pass null
|
|
94
94
|
* */
|
|
95
|
-
export type StateConfigCallbackParam<TState, TMetadata, TStateSetter extends ActionCollectionConfig<TState, TMetadata> | GlobalStoreBase.StateSetter<TState> = GlobalStoreBase.StateSetter<TState>> = {
|
|
95
|
+
export type StateConfigCallbackParam<TState = any, TMetadata = null, TStateSetter extends ActionCollectionConfig<TState, TMetadata> | GlobalStoreBase.StateSetter<TState> = GlobalStoreBase.StateSetter<TState>> = {
|
|
96
96
|
actions: ActionCollectionResult<TState, TMetadata, TStateSetter>;
|
|
97
97
|
} & StoreTools<TState, TMetadata>;
|
|
98
98
|
/**
|
|
@@ -101,7 +101,7 @@ export type StateConfigCallbackParam<TState, TMetadata, TStateSetter extends Act
|
|
|
101
101
|
* @template {TMetadata} TMetadata - The metadata type
|
|
102
102
|
* @template {TStateSetter} TStateSetter - The storeActionsConfig type (optional) - if you pass an storeActionsConfig the hook will return an object with the actions
|
|
103
103
|
*/
|
|
104
|
-
export type StateChangesParam<TState, TMetadata, TStateSetter extends ActionCollectionConfig<TState, TMetadata> | GlobalStoreBase.StateSetter<TState> = GlobalStoreBase.StateSetter<TState>> = StateConfigCallbackParam<TState, TMetadata, TStateSetter> & GlobalStoreBase.StateChanges<TState>;
|
|
104
|
+
export type StateChangesParam<TState = any, TMetadata = null, TStateSetter extends ActionCollectionConfig<TState, TMetadata> | GlobalStoreBase.StateSetter<TState> = GlobalStoreBase.StateSetter<TState>> = StateConfigCallbackParam<TState, TMetadata, TStateSetter> & GlobalStoreBase.StateChanges<TState>;
|
|
105
105
|
/**
|
|
106
106
|
* Configuration of the store (optional) - if you don't need to use the store configuration you don't need to pass this parameter
|
|
107
107
|
* @param {StateConfigCallbackParam<TState, TMetadata> => void} onInit - callback function called when the store is initialized
|
|
@@ -4,13 +4,13 @@ import { GlobalStoreConfig } from "./GlobalStore.types";
|
|
|
4
4
|
* Get an item from local storage using the config provided.
|
|
5
5
|
*/
|
|
6
6
|
export declare const getAsyncStorageItem: <TState, TMetadata = null>({ config, }: {
|
|
7
|
-
config: GlobalStoreConfig<TState, TMetadata
|
|
7
|
+
config: GlobalStoreConfig<TState, TMetadata>;
|
|
8
8
|
}) => Promise<TState>;
|
|
9
9
|
/**
|
|
10
10
|
* @description
|
|
11
11
|
* Set an item to local storage using the config provided.
|
|
12
12
|
*/
|
|
13
13
|
export declare const setAsyncStorageItem: <TState, TMetadata = null>({ item, config, }: {
|
|
14
|
-
config: GlobalStoreConfig<TState, TMetadata
|
|
14
|
+
config: GlobalStoreConfig<TState, TMetadata>;
|
|
15
15
|
item: TState;
|
|
16
16
|
}) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-global-state-hooks",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.7",
|
|
4
4
|
"description": "This is a package to easily handling global-state across your react-native-components No-redux... The library now includes @react-native-async-storage/async-storage to persist your state across sessions... if you want to keep using the old version without async-storage or react-native dependencies just use version 5.0.15 or user react-hooks-global-states instead",
|
|
5
5
|
"main": "lib/bundle.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"ts-jest": "^29.1.1",
|
|
73
73
|
"ts-loader": "^9.4.2",
|
|
74
74
|
"tslib": "^2.5.0",
|
|
75
|
-
"typescript": "^
|
|
75
|
+
"typescript": "^5.3.3",
|
|
76
76
|
"webpack": "^5.76.3",
|
|
77
77
|
"webpack-cli": "^5.0.1"
|
|
78
78
|
},
|
|
@@ -93,6 +93,6 @@
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"react-hooks-global-states": "^1.0.
|
|
96
|
+
"react-hooks-global-states": "^1.0.5"
|
|
97
97
|
}
|
|
98
98
|
}
|