hybrid-navigation 2.16.7 → 2.16.8

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.
@@ -33,5 +33,5 @@ dependencies {
33
33
  implementation fileTree(dir: 'libs', include: ['*.jar'])
34
34
  implementation 'com.facebook.react:react-native:+'
35
35
  // api project(':navigation')
36
- api 'io.github.listenzz:AndroidNavigation:13.6.3'
36
+ api 'io.github.listenzz:AndroidNavigation:13.6.4'
37
37
  }
@@ -103,7 +103,7 @@ public class HybridFragment extends AwesomeFragment {
103
103
  @Override
104
104
  protected BarStyle preferredStatusBarStyle() {
105
105
  if (forceTransparentDialogWindow()) {
106
- return SystemUI.activityNavigationBarStyle(requireActivity());
106
+ return SystemUI.activityStatusBarStyle(requireActivity());
107
107
  }
108
108
 
109
109
  if (getPresentationStyle() == PresentationStyle.OverFullScreen) {
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>HybridNavigation.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
package/lib/hooks.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Navigator } from './Navigator';
3
- export declare function useVisible(): boolean;
3
+ export declare function useNavigator(): Navigator;
4
4
  export declare function useVisibility(): "visible" | "invisible" | "pending";
5
+ export declare function useVisible(): boolean;
5
6
  export declare function useVisibleEffect(effect: React.EffectCallback): void;
6
- export declare function useNavigator(): Navigator;
7
7
  /**
8
8
  * @deprecated Use Navigation related methods instead.
9
9
  * @returns
package/lib/hooks.js CHANGED
@@ -1,9 +1,8 @@
1
- import { useContext, useEffect, useRef, useState } from 'react';
1
+ import { useContext, useEffect, useState } from 'react';
2
2
  import Navigation from './Navigation';
3
3
  import { NavigationContext } from './Navigator';
4
- export function useVisible() {
5
- const visibility = useVisibility();
6
- return visibility === 'visible';
4
+ export function useNavigator() {
5
+ return useContext(NavigationContext);
7
6
  }
8
7
  export function useVisibility() {
9
8
  const navigator = useNavigator();
@@ -16,31 +15,18 @@ export function useVisibility() {
16
15
  }, [navigator]);
17
16
  return visibility;
18
17
  }
18
+ export function useVisible() {
19
+ const visibility = useVisibility();
20
+ return visibility === 'visible';
21
+ }
19
22
  export function useVisibleEffect(effect) {
20
- const navigator = useNavigator();
21
- const destructor = useRef();
23
+ const visible = useVisible();
22
24
  useEffect(() => {
23
- if (navigator.visibility === 'visible') {
24
- destructor.current = effect();
25
- }
26
- const subscription = Navigation.addVisibilityEventListener(navigator.sceneId, visibility => {
27
- if (visibility === 'visible') {
28
- destructor.current = effect();
29
- }
30
- else {
31
- destructor.current && destructor.current();
32
- destructor.current = undefined;
33
- }
34
- });
35
- return () => {
36
- destructor.current && destructor.current();
37
- destructor.current = undefined;
38
- subscription.remove();
39
- };
40
- }, [effect, navigator]);
41
- }
42
- export function useNavigator() {
43
- return useContext(NavigationContext);
25
+ if (!visible)
26
+ return;
27
+ const destructor = effect();
28
+ return () => destructor && destructor();
29
+ }, [effect, visible]);
44
30
  }
45
31
  /**
46
32
  * @deprecated Use Navigation related methods instead.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hybrid-navigation",
3
3
  "description": "React Native Navigation that supports seamless navigation between Native and React.",
4
- "version": "2.16.7",
4
+ "version": "2.16.8",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",
@@ -57,6 +57,7 @@
57
57
  "@gfez/eslint-config-react-native": "^1.0.0",
58
58
  "@react-native-community/hooks": "^2.8.0",
59
59
  "@react-native-community/slider": "^4.4.2",
60
+ "@sdcx/keyboard-insets": "^0.5.0",
60
61
  "@types/jest": "^29.2.1",
61
62
  "@types/react": "^18.0.24",
62
63
  "@types/react-redux": "^7.1.9",
@@ -67,7 +68,6 @@
67
68
  "react": "18.2.0",
68
69
  "react-native": "^0.71.3",
69
70
  "react-native-fast-image": "^8.5.11",
70
- "react-native-keyboard-insets": "^1.3.3",
71
71
  "react-native-safe-area-context": "^4.7.1",
72
72
  "react-native-toast-hybrid": "^2.5.0",
73
73
  "react-redux": "^7.2.5",
package/src/hooks.ts CHANGED
@@ -1,10 +1,9 @@
1
- import React, { useContext, useEffect, useRef, useState } from 'react'
1
+ import React, { useContext, useEffect, useState } from 'react'
2
2
  import Navigation from './Navigation'
3
3
  import { Navigator, NavigationContext } from './Navigator'
4
4
 
5
- export function useVisible() {
6
- const visibility = useVisibility()
7
- return visibility === 'visible'
5
+ export function useNavigator(): Navigator {
6
+ return useContext<Navigator>(NavigationContext)
8
7
  }
9
8
 
10
9
  export function useVisibility() {
@@ -21,34 +20,18 @@ export function useVisibility() {
21
20
  return visibility
22
21
  }
23
22
 
24
- export function useVisibleEffect(effect: React.EffectCallback) {
25
- const navigator = useNavigator()
26
- const destructor = useRef<ReturnType<React.EffectCallback>>()
27
-
28
- useEffect(() => {
29
- if (navigator.visibility === 'visible') {
30
- destructor.current = effect()
31
- }
32
-
33
- const subscription = Navigation.addVisibilityEventListener(navigator.sceneId, visibility => {
34
- if (visibility === 'visible') {
35
- destructor.current = effect()
36
- } else {
37
- destructor.current && destructor.current()
38
- destructor.current = undefined
39
- }
40
- })
41
-
42
- return () => {
43
- destructor.current && destructor.current()
44
- destructor.current = undefined
45
- subscription.remove()
46
- }
47
- }, [effect, navigator])
23
+ export function useVisible() {
24
+ const visibility = useVisibility()
25
+ return visibility === 'visible'
48
26
  }
49
27
 
50
- export function useNavigator(): Navigator {
51
- return useContext<Navigator>(NavigationContext)
28
+ export function useVisibleEffect(effect: React.EffectCallback) {
29
+ const visible = useVisible()
30
+ useEffect(() => {
31
+ if (!visible) return
32
+ const destructor = effect()
33
+ return () => destructor && destructor()
34
+ }, [effect, visible])
52
35
  }
53
36
 
54
37
  /**