hybrid-navigation 2.18.4 → 2.18.5

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.
@@ -1,18 +1,15 @@
1
1
  package com.reactnative.hybridnavigation;
2
2
 
3
+ import android.annotation.SuppressLint;
3
4
  import android.content.Context;
4
5
  import android.os.Bundle;
5
6
  import android.util.AttributeSet;
6
7
  import android.view.MotionEvent;
7
- import android.view.ViewTreeObserver;
8
8
 
9
9
  import androidx.annotation.Nullable;
10
10
 
11
- import com.facebook.react.ReactInstanceManager;
12
11
  import com.facebook.react.ReactRootView;
13
12
 
14
- import java.lang.reflect.Method;
15
-
16
13
  public class HBDReactRootView extends ReactRootView {
17
14
 
18
15
  protected static final String TAG = "Navigation";
@@ -35,7 +32,8 @@ public class HBDReactRootView extends ReactRootView {
35
32
  this.shouldConsumeTouchEvent = consume;
36
33
  }
37
34
 
38
- @Override
35
+ @SuppressLint("ClickableViewAccessibility")
36
+ @Override
39
37
  public boolean onTouchEvent(MotionEvent ev) {
40
38
  int action = ev.getAction() & MotionEvent.ACTION_MASK;
41
39
  if (action == MotionEvent.ACTION_DOWN) {
@@ -44,24 +42,6 @@ public class HBDReactRootView extends ReactRootView {
44
42
  return shouldConsumeTouchEvent;
45
43
  }
46
44
 
47
- @Override
48
- protected void onAttachedToWindow() {
49
- super.onAttachedToWindow();
50
- removeOnGlobalLayoutListener();
51
- }
52
-
53
- @Override
54
- protected void onDetachedFromWindow() {
55
- super.onDetachedFromWindow();
56
- removeOnGlobalLayoutListener();
57
- }
58
-
59
- @Override
60
- public void startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName, @Nullable Bundle initialProperties) {
61
- super.startReactApplication(reactInstanceManager, moduleName, initialProperties);
62
- removeOnGlobalLayoutListener();
63
- }
64
-
65
45
  // 避免 reload 时,重复 run 的问题
66
46
  private boolean shouldRunApplication = true;
67
47
 
@@ -72,7 +52,7 @@ public class HBDReactRootView extends ReactRootView {
72
52
  super.runApplication();
73
53
  }
74
54
  }
75
-
55
+
76
56
  private boolean hbd_isAttachedToReactInstance;
77
57
 
78
58
  @Override
@@ -88,34 +68,4 @@ public class HBDReactRootView extends ReactRootView {
88
68
  super.setAppProperties(appProperties);
89
69
  }
90
70
  }
91
-
92
- @Override
93
- public void unmountReactApplication() {
94
- super.unmountReactApplication();
95
- removeOnGlobalLayoutListener();
96
- }
97
-
98
- private ViewTreeObserver.OnGlobalLayoutListener mGlobalLayoutListener;
99
-
100
- private ViewTreeObserver.OnGlobalLayoutListener getGlobalLayoutListener() {
101
- if (mGlobalLayoutListener == null) {
102
- try {
103
- Method method = ReactRootView.class.getDeclaredMethod("getCustomGlobalLayoutListener");
104
- method.setAccessible(true);
105
- mGlobalLayoutListener = (ViewTreeObserver.OnGlobalLayoutListener) method.invoke(this);
106
- } catch (Exception e) {
107
- e.printStackTrace();
108
- }
109
- }
110
- return mGlobalLayoutListener;
111
- }
112
-
113
- void addOnGlobalLayoutListener() {
114
- removeOnGlobalLayoutListener();
115
- getViewTreeObserver().addOnGlobalLayoutListener(getGlobalLayoutListener());
116
- }
117
-
118
- void removeOnGlobalLayoutListener() {
119
- getViewTreeObserver().removeOnGlobalLayoutListener(getGlobalLayoutListener());
120
- }
121
71
  }
@@ -84,7 +84,6 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
84
84
  public void onResume() {
85
85
  super.onResume();
86
86
  if (isViewReady()) {
87
- reactRootView.addOnGlobalLayoutListener();
88
87
  sendViewAppearEvent(true);
89
88
  }
90
89
  }
@@ -94,7 +93,6 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
94
93
  super.onPause();
95
94
  if (isViewReady()) {
96
95
  sendViewAppearEvent(false);
97
- reactRootView.removeOnGlobalLayoutListener();
98
96
  }
99
97
  }
100
98
 
@@ -206,7 +204,6 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
206
204
 
207
205
  if (isViewReady() && isResumed()) {
208
206
  sendViewAppearEvent(true);
209
- reactRootView.addOnGlobalLayoutListener();
210
207
  }
211
208
  }
212
209
 
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.18.4",
4
+ "version": "2.18.5",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
7
7
  "react-native": "src/index",