@applicaster/quick-brick-core 12.0.0-alpha.6236157458 → 12.0.0-alpha.6602834797
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/App/ThemeManager/index.tsx +8 -18
- package/package.json +8 -8
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import { isEqual } from "@applicaster/zapp-react-native-utils/equalUtils";
|
|
5
4
|
import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
|
|
6
5
|
import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
7
6
|
import {
|
|
@@ -81,21 +80,16 @@ const ThemeContextProvider = ({
|
|
|
81
80
|
setSelectedThemeId,
|
|
82
81
|
children,
|
|
83
82
|
}: any) => {
|
|
84
|
-
const value =
|
|
83
|
+
const value = React.useMemo(
|
|
84
|
+
() => ({ themes, selectedThemeId, setSelectedThemeId }),
|
|
85
|
+
[themes, selectedThemeId, setSelectedThemeId]
|
|
86
|
+
);
|
|
85
87
|
|
|
86
88
|
return (
|
|
87
89
|
<ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
88
90
|
);
|
|
89
91
|
};
|
|
90
92
|
|
|
91
|
-
const MemoizedThemeContextProvider = React.memo(
|
|
92
|
-
ThemeContextProvider,
|
|
93
|
-
isEqual({
|
|
94
|
-
byValue: ["selectedThemeId", "setSelectedThemeId"],
|
|
95
|
-
byReference: ["children", "themes"],
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
|
|
99
93
|
function ThemeManagerComponent({ children, plugins }: Props) {
|
|
100
94
|
const dimensions = useDimensions("screen", { deviceInfo: true });
|
|
101
95
|
const [themes, setThemes] = React.useState(selectThemes(dimensions, plugins));
|
|
@@ -104,22 +98,18 @@ function ThemeManagerComponent({ children, plugins }: Props) {
|
|
|
104
98
|
React.useState(DEFAULT_THEME_ID);
|
|
105
99
|
|
|
106
100
|
React.useEffect(() => {
|
|
107
|
-
setThemes((
|
|
108
|
-
const newThemes = selectThemes(dimensions, plugins);
|
|
109
|
-
|
|
110
|
-
return R.equals(oldThemes, newThemes) ? oldThemes : newThemes;
|
|
111
|
-
});
|
|
101
|
+
setThemes(selectThemes(dimensions, plugins));
|
|
112
102
|
}, [plugins, dimensions]);
|
|
113
103
|
|
|
114
104
|
return (
|
|
115
|
-
<
|
|
105
|
+
<ThemeContextProvider
|
|
116
106
|
themes={themes}
|
|
117
107
|
selectedThemeId={selectedThemeId}
|
|
118
108
|
setSelectedThemeId={setSelectedThemeId}
|
|
119
109
|
>
|
|
120
110
|
{children}
|
|
121
|
-
</
|
|
111
|
+
</ThemeContextProvider>
|
|
122
112
|
);
|
|
123
113
|
}
|
|
124
114
|
|
|
125
|
-
export const ThemeManager = ThemeManagerComponent;
|
|
115
|
+
export const ThemeManager = React.memo<Props>(ThemeManagerComponent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.6602834797",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
34
|
-
"@applicaster/quick-brick-core-plugins": "12.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
33
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.6602834797",
|
|
34
|
+
"@applicaster/quick-brick-core-plugins": "12.0.0-alpha.6602834797",
|
|
35
|
+
"@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.6602834797",
|
|
36
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.6602834797",
|
|
37
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.6602834797",
|
|
38
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.6602834797",
|
|
39
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.6602834797",
|
|
40
40
|
"atob": "^2.1.2",
|
|
41
41
|
"axios": "^0.21.2",
|
|
42
42
|
"btoa": "^1.2.1",
|