ikualo-ui-kit-mobile 0.7.4 → 0.7.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ikualo-ui-kit-mobile",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "main": "src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -11,10 +11,16 @@ export const Provider = (props: { children: ReactNode, onChange?: (theme: ITheme
11
11
  useEffect(() => {
12
12
  const listener = Appearance.addChangeListener(({ colorScheme }) => {
13
13
  if (colorScheme) {
14
- setTheme(colorScheme === 'dark' ? darkTheme : lightTheme);
15
- props.onChange && props.onChange(colorScheme === 'dark' ? darkTheme : lightTheme);
14
+ const themeToApply = colorScheme === 'dark' ? darkTheme : lightTheme;
15
+ setTheme(themeToApply);
16
+ props.onChange && props.onChange(themeToApply);
16
17
  }
17
18
  });
19
+ const initialColorScheme = Appearance.getColorScheme();
20
+ const initialTheme = initialColorScheme === 'dark' ? darkTheme : lightTheme;
21
+ setTheme(initialTheme);
22
+ props.onChange && props.onChange(initialTheme);
23
+
18
24
  return () => listener.remove();
19
25
  }, []);
20
26
  return (