@hoddy-ui/next 2.0.32 → 2.0.34

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.
@@ -7,30 +7,24 @@ const AdaptiveStatusBar = ({ translucent = false }) => {
7
7
  const [focused, setFocused] = useState(false);
8
8
  const colors = useColors();
9
9
  const theme = useTheme();
10
+ const statusbarHandler = () => {
11
+ StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
12
+ if (Platform.OS === "android") {
13
+ StatusBar.setBackgroundColor(
14
+ translucent ? "transparent" : colors.white[1]
15
+ );
16
+ StatusBar.setTranslucent(true);
17
+ }
18
+ };
19
+
10
20
  useFocusEffect(
11
21
  React.useCallback(() => {
12
- // setFocused(true);
13
- StatusBar.setBarStyle(
14
- theme === "dark" ? "light-content" : "dark-content"
15
- );
16
- if (Platform.OS === "android") {
17
- StatusBar.setBackgroundColor(
18
- colors.white[1] + (translucent ? "0" : "")
19
- );
20
- StatusBar.setTranslucent(true);
21
- }
22
- // return () => setFocused(false);
22
+ statusbarHandler();
23
23
  }, [theme])
24
24
  );
25
25
 
26
26
  React.useEffect(() => {
27
- // setFocused(true);
28
- StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
29
- if (Platform.OS === "android") {
30
- StatusBar.setBackgroundColor(colors.white[1] + (translucent ? "0" : ""));
31
- StatusBar.setTranslucent(true);
32
- }
33
- // return () => setFocused(false);
27
+ statusbarHandler();
34
28
  }, [theme]);
35
29
  return <></>;
36
30
  };
package/dist/index.js CHANGED
@@ -528,25 +528,22 @@ var AdaptiveStatusBar = ({ translucent = false }) => {
528
528
  const [focused, setFocused] = (0, import_react5.useState)(false);
529
529
  const colors2 = useColors();
530
530
  const theme = useTheme();
531
+ const statusbarHandler = () => {
532
+ import_react_native5.StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
533
+ if (import_react_native5.Platform.OS === "android") {
534
+ import_react_native5.StatusBar.setBackgroundColor(
535
+ translucent ? "transparent" : colors2.white[1]
536
+ );
537
+ import_react_native5.StatusBar.setTranslucent(true);
538
+ }
539
+ };
531
540
  (0, import_expo_router.useFocusEffect)(
532
541
  import_react5.default.useCallback(() => {
533
- import_react_native5.StatusBar.setBarStyle(
534
- theme === "dark" ? "light-content" : "dark-content"
535
- );
536
- if (import_react_native5.Platform.OS === "android") {
537
- import_react_native5.StatusBar.setBackgroundColor(
538
- colors2.white[1] + (translucent ? "0" : "")
539
- );
540
- import_react_native5.StatusBar.setTranslucent(true);
541
- }
542
+ statusbarHandler();
542
543
  }, [theme])
543
544
  );
544
545
  import_react5.default.useEffect(() => {
545
- import_react_native5.StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
546
- if (import_react_native5.Platform.OS === "android") {
547
- import_react_native5.StatusBar.setBackgroundColor(colors2.white[1] + (translucent ? "0" : ""));
548
- import_react_native5.StatusBar.setTranslucent(true);
549
- }
546
+ statusbarHandler();
550
547
  }, [theme]);
551
548
  return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null);
552
549
  };