ikualo-ui-kit-mobile 0.7.3 → 0.7.4
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.tsx +2 -17
- package/package.json +1 -1
- package/src/elements/pages/Provider.tsx +17 -3
package/App.tsx
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { darkTheme, lightTheme } from './src/config/paper.config';
|
|
2
1
|
import { useFonts } from 'expo-font';
|
|
3
|
-
import React
|
|
4
|
-
import { Appearance } from 'react-native';
|
|
5
|
-
import useStore from './src/store';
|
|
2
|
+
import React from 'react';
|
|
6
3
|
import { PageTouchable, Provider } from './src';
|
|
7
4
|
import { Views } from './src/elements/views/Views';
|
|
8
5
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
@@ -17,21 +14,9 @@ export default function App() {
|
|
|
17
14
|
MontserratAlternatesExtraBold: require('./assets/fonts/MontserratAlternatesExtraBold.ttf'), //900
|
|
18
15
|
MontserratAlternatesBold: require('./assets/fonts/MontserratAlternatesBold.ttf'), //700
|
|
19
16
|
});
|
|
20
|
-
const { theme, setTheme } = useStore();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const listener = Appearance.addChangeListener(({ colorScheme }) => {
|
|
25
|
-
if (colorScheme) {
|
|
26
|
-
setTheme(colorScheme === 'dark' ? darkTheme : lightTheme);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return () => listener.remove();
|
|
30
|
-
}, []);
|
|
31
17
|
|
|
32
18
|
return (
|
|
33
|
-
<
|
|
34
|
-
|
|
19
|
+
<GestureHandlerRootView >
|
|
35
20
|
{fontsLoaded && (
|
|
36
21
|
<Provider >
|
|
37
22
|
<PageTouchable>
|
package/package.json
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { PaperProvider } from "react-native-paper"
|
|
2
2
|
import useStore from "../../store"
|
|
3
|
-
import { ReactNode } from "react"
|
|
3
|
+
import { ReactNode, useEffect } from "react"
|
|
4
|
+
import { ITheme } from "../../models"
|
|
5
|
+
import { Appearance } from "react-native"
|
|
6
|
+
import { darkTheme, lightTheme } from "../../config/paper.config"
|
|
4
7
|
|
|
5
|
-
export const Provider = (props: { children: ReactNode }) => {
|
|
8
|
+
export const Provider = (props: { children: ReactNode, onChange?: (theme: ITheme) => void }) => {
|
|
9
|
+
const { setTheme, theme } = useStore()
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const listener = Appearance.addChangeListener(({ colorScheme }) => {
|
|
13
|
+
if (colorScheme) {
|
|
14
|
+
setTheme(colorScheme === 'dark' ? darkTheme : lightTheme);
|
|
15
|
+
props.onChange && props.onChange(colorScheme === 'dark' ? darkTheme : lightTheme);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return () => listener.remove();
|
|
19
|
+
}, []);
|
|
6
20
|
return (
|
|
7
|
-
<PaperProvider theme={
|
|
21
|
+
<PaperProvider theme={theme} >
|
|
8
22
|
{props.children}
|
|
9
23
|
</PaperProvider>)
|
|
10
24
|
}
|