react-native-package-fast 0.1.5 → 0.1.6
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/package.json +1 -1
- package/src/module/cores/InputApp.js +1 -1
- package/src/module/cores/StoresProviderApp.js +54 -0
- package/src/module/index.js +7 -5
- package/src/module/package.json +4 -0
- package/src/typescript/cores/StoresProviderApp.d.ts +9 -0
- package/src/typescript/cores/Utils.d.ts +4 -2
- package/src/typescript/index.d.ts +7 -5
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { TextInput } from 'react-native';
|
|
|
4
4
|
import { InputAppStyles, parseStyles } from './Utils';
|
|
5
5
|
const InputApp = props => {
|
|
6
6
|
let styleAll = parseStyles({
|
|
7
|
-
passStyle: ['flex', 'width', 'height'],
|
|
7
|
+
passStyle: ['flex', 'width', 'height', 'minHeight'],
|
|
8
8
|
styles: InputAppStyles,
|
|
9
9
|
props
|
|
10
10
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { createContext, memo, useContext, useMemo, useReducer } from 'react';
|
|
2
|
+
export let DATA_CACHE_STORE = {
|
|
3
|
+
key: 'KEY_CACHE',
|
|
4
|
+
data: {}
|
|
5
|
+
};
|
|
6
|
+
const Context = /*#__PURE__*/createContext(undefined);
|
|
7
|
+
export const getContextStore = () => {
|
|
8
|
+
return useContext(Context);
|
|
9
|
+
};
|
|
10
|
+
const StoresProviderApp = props => {
|
|
11
|
+
const {
|
|
12
|
+
children,
|
|
13
|
+
initParams,
|
|
14
|
+
keyStore
|
|
15
|
+
} = props || {};
|
|
16
|
+
useMemo(() => {
|
|
17
|
+
if (keyStore) DATA_CACHE_STORE.key = keyStore;
|
|
18
|
+
}, []);
|
|
19
|
+
const [state, dispatch] = useReducer(ReducerCache, initParams);
|
|
20
|
+
const value = [state, dispatch];
|
|
21
|
+
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
22
|
+
value: value
|
|
23
|
+
}, children);
|
|
24
|
+
};
|
|
25
|
+
const Reducers = (state, params) => {
|
|
26
|
+
const {
|
|
27
|
+
key
|
|
28
|
+
} = (params === null || params === void 0 ? void 0 : params.action) || {};
|
|
29
|
+
if (key === 'all') {
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
...params.payload
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (key) {
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
[key]: params.payload
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return state;
|
|
42
|
+
};
|
|
43
|
+
const ReducerCache = (state, params) => {
|
|
44
|
+
let cache = Reducers(state, params);
|
|
45
|
+
let cacheSave = {
|
|
46
|
+
...cache
|
|
47
|
+
};
|
|
48
|
+
delete cacheSave.params;
|
|
49
|
+
delete cacheSave.isSoundOn;
|
|
50
|
+
DATA_CACHE_STORE.data = cacheSave;
|
|
51
|
+
return cache;
|
|
52
|
+
};
|
|
53
|
+
export default /*#__PURE__*/memo(StoresProviderApp);
|
|
54
|
+
//# sourceMappingURL=StoresProviderApp.js.map
|
package/src/module/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import TextApp from './cores/TextApp';
|
|
2
|
-
import ViewApp from './cores/ViewApp';
|
|
3
1
|
import ButtonApp from './cores/ButtonApp';
|
|
2
|
+
import { ScaleSize } from './cores/DeviceUtils';
|
|
4
3
|
import ImageApp from './cores/ImageApp';
|
|
5
|
-
import InputApp from './cores/InputApp';
|
|
6
4
|
import ImageFastApp from './cores/ImageFastApp';
|
|
7
|
-
import
|
|
8
|
-
|
|
5
|
+
import InputApp from './cores/InputApp';
|
|
6
|
+
import TextApp from './cores/TextApp';
|
|
7
|
+
import { parseStyles } from './cores/Utils';
|
|
8
|
+
import ViewApp from './cores/ViewApp';
|
|
9
|
+
import StoresProviderApp, { DATA_CACHE_STORE, getContextStore } from './cores/StoresProviderApp';
|
|
10
|
+
export { ButtonApp, ImageApp, StoresProviderApp, DATA_CACHE_STORE, getContextStore, ImageFastApp, InputApp, parseStyles, ScaleSize, TextApp, ViewApp };
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare let DATA_CACHE_STORE: {
|
|
3
|
+
key: string;
|
|
4
|
+
data: {};
|
|
5
|
+
};
|
|
6
|
+
export declare const getContextStore: () => undefined;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<(props: any) => React.JSX.Element>;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=StoresProviderApp.d.ts.map
|
|
@@ -292,6 +292,7 @@ export declare const ButtonAppStyles: {
|
|
|
292
292
|
};
|
|
293
293
|
export interface InputAppProps extends TextInputProps, CommonProps {
|
|
294
294
|
borderType?: any;
|
|
295
|
+
minHeight?: any;
|
|
295
296
|
}
|
|
296
297
|
export declare const InputAppStyles: {
|
|
297
298
|
borderType: {
|
|
@@ -326,14 +327,15 @@ export interface ImageFastAppProps extends FastImageProps, CommonProps {
|
|
|
326
327
|
ratio?: any;
|
|
327
328
|
color?: any;
|
|
328
329
|
}
|
|
329
|
-
export
|
|
330
|
+
export type ImageAppProps = ImageProps & CommonProps & {
|
|
330
331
|
contain?: any;
|
|
331
332
|
cover?: any;
|
|
332
333
|
stretch?: any;
|
|
333
334
|
size?: any;
|
|
334
335
|
ratio?: any;
|
|
335
336
|
color?: any;
|
|
336
|
-
|
|
337
|
+
source?: any;
|
|
338
|
+
};
|
|
337
339
|
export declare const ImageAppStyles: {
|
|
338
340
|
contain: {
|
|
339
341
|
resizeMode: "contain";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import TextApp from './cores/TextApp';
|
|
2
|
-
import ViewApp from './cores/ViewApp';
|
|
3
1
|
import ButtonApp from './cores/ButtonApp';
|
|
2
|
+
import { ScaleSize } from './cores/DeviceUtils';
|
|
4
3
|
import ImageApp from './cores/ImageApp';
|
|
5
|
-
import InputApp from './cores/InputApp';
|
|
6
4
|
import ImageFastApp from './cores/ImageFastApp';
|
|
7
|
-
import
|
|
8
|
-
|
|
5
|
+
import InputApp from './cores/InputApp';
|
|
6
|
+
import TextApp from './cores/TextApp';
|
|
7
|
+
import { parseStyles, TextAppProps, ViewAppProps, ImageFastAppProps, InputAppProps, ButtonAppProps } from './cores/Utils';
|
|
8
|
+
import ViewApp from './cores/ViewApp';
|
|
9
|
+
import StoresProviderApp, { DATA_CACHE_STORE, getContextStore } from './cores/StoresProviderApp';
|
|
10
|
+
export { ButtonApp, ImageApp, StoresProviderApp, DATA_CACHE_STORE, getContextStore, ImageFastApp, InputApp, parseStyles, ScaleSize, TextApp, ViewApp, type TextAppProps, type ViewAppProps, type ImageFastAppProps, type InputAppProps, type ButtonAppProps, };
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|