react-native-external-keyboard 0.8.2 → 0.8.3-rc
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.
|
@@ -154,20 +154,20 @@ public class ExternalKeyboardView extends ReactViewGroup {
|
|
|
154
154
|
|
|
155
155
|
if (direction == FOCUS_FORWARD && orderForward != null) {
|
|
156
156
|
View nextView = this.focusOrderDelegate.getLink(orderForward);
|
|
157
|
-
if (nextView
|
|
157
|
+
if (isValidLinkedFocusTarget(nextView)) {
|
|
158
158
|
return nextView;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
if (direction == FOCUS_BACKWARD && orderBackward != null) {
|
|
163
163
|
View prevView = this.focusOrderDelegate.getLink(orderBackward);
|
|
164
|
-
if (prevView
|
|
164
|
+
if (isValidLinkedFocusTarget(prevView)) {
|
|
165
165
|
return prevView;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
if(ReactNativeVersionChecker.isReactNative80OrLater()) {
|
|
170
|
-
if(orderGroup != null && orderIndex != null && (direction == FOCUS_FORWARD || direction == FOCUS_BACKWARD)){
|
|
169
|
+
if (ReactNativeVersionChecker.isReactNative80OrLater()) {
|
|
170
|
+
if (orderGroup != null && orderIndex != null && (direction == FOCUS_FORWARD || direction == FOCUS_BACKWARD)) {
|
|
171
171
|
return FocusFinder.getInstance().findNextFocus((ViewGroup) this.getParent(), focused, direction);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -292,6 +292,22 @@ public class ExternalKeyboardView extends ReactViewGroup {
|
|
|
292
292
|
return focusableView != null ? focusableView : this;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
private boolean isValidLinkedFocusTarget(View target) {
|
|
296
|
+
if (target == null || !target.isAttachedToWindow() || !this.isAttachedToWindow()) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (target.getWindowToken() == null || this.getWindowToken() == null) {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (target.getWindowToken() != this.getWindowToken()) {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return target.getRootView() == this.getRootView();
|
|
309
|
+
}
|
|
310
|
+
|
|
295
311
|
public void setCanBeFocused(boolean canBeFocused) {
|
|
296
312
|
int descendantFocusability = canBeFocused ? ViewGroup.FOCUS_BEFORE_DESCENDANTS : ViewGroup.FOCUS_BLOCK_DESCENDANTS;
|
|
297
313
|
this.setDescendantFocusability(descendantFocusability);
|
package/package.json
CHANGED