react-native-external-keyboard 0.8.4-rc2 → 0.8.5-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.
- package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegate.java +2 -4
- package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegateHost.java +14 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +2 -1
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +150 -3
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +92 -0
- package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +24 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +2 -2
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +5 -6
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.h +38 -2
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +167 -10
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +69 -0
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -0
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +12 -0
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -0
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +12 -0
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +11 -0
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +12 -0
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +56 -0
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +11 -0
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +12 -0
|
@@ -5,10 +5,8 @@ import android.view.View;
|
|
|
5
5
|
import com.externalkeyboard.helper.Linking.A11yOrderLinking;
|
|
6
6
|
import com.externalkeyboard.services.FocusLinkObserver.FocusLinkObserver;
|
|
7
7
|
import com.externalkeyboard.services.FocusLinkObserver.FocusLinkObserverSingleton;
|
|
8
|
-
import com.externalkeyboard.views.ExternalKeyboardView.ExternalKeyboardView;
|
|
9
|
-
|
|
10
8
|
public class FocusOrderDelegate {
|
|
11
|
-
private final
|
|
9
|
+
private final FocusOrderDelegateHost delegate;
|
|
12
10
|
|
|
13
11
|
FocusLinkObserver.LinkUpdatedCallback leftUpdated = null;
|
|
14
12
|
FocusLinkObserver.LinkRemovedCallback leftRemoved = null;
|
|
@@ -20,7 +18,7 @@ public class FocusOrderDelegate {
|
|
|
20
18
|
FocusLinkObserver.LinkRemovedCallback downRemoved = null;
|
|
21
19
|
|
|
22
20
|
|
|
23
|
-
public FocusOrderDelegate(
|
|
21
|
+
public FocusOrderDelegate(FocusOrderDelegateHost delegate) {
|
|
24
22
|
super();
|
|
25
23
|
this.delegate = delegate;
|
|
26
24
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.externalkeyboard.delegates;
|
|
2
|
+
|
|
3
|
+
import android.view.View;
|
|
4
|
+
|
|
5
|
+
public interface FocusOrderDelegateHost {
|
|
6
|
+
View getFirstChild();
|
|
7
|
+
String getOrderGroup();
|
|
8
|
+
Integer getOrderIndex();
|
|
9
|
+
String getOrderId();
|
|
10
|
+
String getOrderLeft();
|
|
11
|
+
String getOrderRight();
|
|
12
|
+
String getOrderUp();
|
|
13
|
+
String getOrderDown();
|
|
14
|
+
}
|
|
@@ -9,6 +9,7 @@ import android.view.ViewTreeObserver;
|
|
|
9
9
|
import android.view.accessibility.AccessibilityEvent;
|
|
10
10
|
|
|
11
11
|
import com.externalkeyboard.delegates.FocusOrderDelegate;
|
|
12
|
+
import com.externalkeyboard.delegates.FocusOrderDelegateHost;
|
|
12
13
|
import com.externalkeyboard.events.EventHelper;
|
|
13
14
|
|
|
14
15
|
import com.externalkeyboard.helper.FocusHelper;
|
|
@@ -22,7 +23,7 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
|
|
22
23
|
import com.facebook.react.uimanager.events.EventDispatcherListener;
|
|
23
24
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
24
25
|
|
|
25
|
-
public class ExternalKeyboardView extends ReactViewGroup {
|
|
26
|
+
public class ExternalKeyboardView extends ReactViewGroup implements FocusOrderDelegateHost {
|
|
26
27
|
public boolean hasKeyDownListener = false;
|
|
27
28
|
public boolean hasKeyUpListener = false;
|
|
28
29
|
public boolean autoFocus = false;
|
|
@@ -10,16 +10,18 @@ import android.widget.EditText;
|
|
|
10
10
|
|
|
11
11
|
import androidx.annotation.NonNull;
|
|
12
12
|
|
|
13
|
+
import com.externalkeyboard.delegates.FocusOrderDelegate;
|
|
14
|
+
import com.externalkeyboard.delegates.FocusOrderDelegateHost;
|
|
13
15
|
import com.externalkeyboard.events.EventHelper;
|
|
16
|
+
import com.externalkeyboard.helper.FocusHelper;
|
|
14
17
|
import com.externalkeyboard.helper.ReactNativeVersionChecker;
|
|
15
18
|
import com.externalkeyboard.modules.ExternalKeyboardModule;
|
|
16
19
|
import com.facebook.react.bridge.ReactContext;
|
|
17
|
-
import com.facebook.react.modules.systeminfo.ReactNativeVersion;
|
|
18
20
|
import com.facebook.react.views.textinput.ReactEditText;
|
|
19
21
|
|
|
20
22
|
import java.lang.reflect.Field;
|
|
21
23
|
|
|
22
|
-
public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChangeListener {
|
|
24
|
+
public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChangeListener, FocusOrderDelegateHost {
|
|
23
25
|
private final Context context;
|
|
24
26
|
public static final byte FOCUS_BY_PRESS = 1;
|
|
25
27
|
private ReactEditText reactEditText = null;
|
|
@@ -30,12 +32,104 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
30
32
|
private boolean multiline = false;
|
|
31
33
|
private boolean keyboardFocusable = true;
|
|
32
34
|
private static View focusedView = null;
|
|
35
|
+
|
|
36
|
+
public int lockFocus = 0;
|
|
37
|
+
public String orderForward;
|
|
38
|
+
public String orderBackward;
|
|
39
|
+
public String orderId;
|
|
40
|
+
|
|
41
|
+
private Integer orderIndex;
|
|
42
|
+
private String orderGroup;
|
|
43
|
+
private String orderUp;
|
|
44
|
+
private String orderDown;
|
|
45
|
+
private String orderLeft;
|
|
46
|
+
private String orderRight;
|
|
47
|
+
|
|
48
|
+
private FocusOrderDelegate focusOrderDelegate;
|
|
49
|
+
private boolean isLinked = false;
|
|
50
|
+
|
|
33
51
|
public boolean getIsFocusByPress() {
|
|
34
52
|
return focusType == FOCUS_BY_PRESS;
|
|
35
53
|
}
|
|
54
|
+
|
|
55
|
+
// FocusOrderDelegateHost implementation
|
|
56
|
+
@Override
|
|
57
|
+
public View getFirstChild() {
|
|
58
|
+
return this.reactEditText;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Override
|
|
62
|
+
public String getOrderGroup() {
|
|
63
|
+
return orderGroup;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Override
|
|
67
|
+
public Integer getOrderIndex() {
|
|
68
|
+
return orderIndex;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public String getOrderId() {
|
|
73
|
+
return orderId;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Override
|
|
77
|
+
public String getOrderLeft() {
|
|
78
|
+
return orderLeft;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Override
|
|
82
|
+
public String getOrderRight() {
|
|
83
|
+
return orderRight;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Override
|
|
87
|
+
public String getOrderUp() {
|
|
88
|
+
return orderUp;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Override
|
|
92
|
+
public String getOrderDown() {
|
|
93
|
+
return orderDown;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public void setOrderGroup(String orderGroup) {
|
|
97
|
+
focusOrderDelegate.updateOrderGroup(this.orderGroup, orderGroup);
|
|
98
|
+
this.orderGroup = orderGroup;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public void setOrderIndex(int orderIndex) {
|
|
102
|
+
if (this.orderIndex == null) {
|
|
103
|
+
this.orderIndex = orderIndex;
|
|
104
|
+
} else {
|
|
105
|
+
this.orderIndex = orderIndex;
|
|
106
|
+
focusOrderDelegate.refreshOrder();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public void setOrderLeft(String orderLeft) {
|
|
111
|
+
focusOrderDelegate.refreshLeft(this.orderLeft, orderLeft);
|
|
112
|
+
this.orderLeft = orderLeft;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public void setOrderRight(String orderRight) {
|
|
116
|
+
focusOrderDelegate.refreshRight(this.orderRight, orderRight);
|
|
117
|
+
this.orderRight = orderRight;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public void setOrderUp(String orderUp) {
|
|
121
|
+
focusOrderDelegate.refreshUp(this.orderUp, orderUp);
|
|
122
|
+
this.orderUp = orderUp;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public void setOrderDown(String orderDown) {
|
|
126
|
+
focusOrderDelegate.refreshDown(this.orderDown, orderDown);
|
|
127
|
+
this.orderDown = orderDown;
|
|
128
|
+
}
|
|
129
|
+
|
|
36
130
|
private boolean getIsNativelyFixedVersion () {
|
|
37
131
|
try {
|
|
38
|
-
Object minorValue = ReactNativeVersion.VERSION.getOrDefault("minor", 0);
|
|
132
|
+
Object minorValue = com.facebook.react.modules.systeminfo.ReactNativeVersion.VERSION.getOrDefault("minor", 0);
|
|
39
133
|
int minor = (minorValue instanceof Integer) ? (int) minorValue : 0;
|
|
40
134
|
return minor >= 79;
|
|
41
135
|
} catch (Exception e) {
|
|
@@ -62,12 +156,14 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
62
156
|
onAttachListener = new View.OnAttachStateChangeListener() {
|
|
63
157
|
@Override
|
|
64
158
|
public void onViewAttachedToWindow(@NonNull View view) {
|
|
159
|
+
focusOrderDelegate.link();
|
|
65
160
|
boolean isAlreadyFixed = getIsNativelyFixedVersion();
|
|
66
161
|
view.setFocusable(isAlreadyFixed);
|
|
67
162
|
}
|
|
68
163
|
|
|
69
164
|
@Override
|
|
70
165
|
public void onViewDetachedFromWindow(@NonNull View view) {
|
|
166
|
+
focusOrderDelegate.unlink(view);
|
|
71
167
|
}
|
|
72
168
|
};
|
|
73
169
|
}
|
|
@@ -143,6 +239,7 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
143
239
|
public TextInputFocusWrapper(Context context) {
|
|
144
240
|
super(context);
|
|
145
241
|
this.context = context;
|
|
242
|
+
this.focusOrderDelegate = new FocusOrderDelegate(this);
|
|
146
243
|
|
|
147
244
|
if (keyboardFocusable) {
|
|
148
245
|
boolean isAlreadyFixed = getIsNativelyFixedVersion();
|
|
@@ -159,8 +256,42 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
159
256
|
onMultiplyBlurSubmitHandle();
|
|
160
257
|
}
|
|
161
258
|
|
|
259
|
+
@Override
|
|
260
|
+
public View focusSearch(View focused, int direction) {
|
|
261
|
+
if (lockFocus == 0 && orderForward == null && orderBackward == null) {
|
|
262
|
+
return super.focusSearch(focused, direction);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
boolean isLocked = FocusHelper.isLocked(direction, lockFocus);
|
|
266
|
+
if (isLocked) {
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (direction == FOCUS_FORWARD && orderForward != null) {
|
|
271
|
+
View nextView = this.focusOrderDelegate.getLink(orderForward);
|
|
272
|
+
if (isValidLinkedFocusTarget(nextView)) {
|
|
273
|
+
return nextView;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (direction == FOCUS_BACKWARD && orderBackward != null) {
|
|
278
|
+
View prevView = this.focusOrderDelegate.getLink(orderBackward);
|
|
279
|
+
if (isValidLinkedFocusTarget(prevView)) {
|
|
280
|
+
return prevView;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return super.focusSearch(focused, direction);
|
|
285
|
+
}
|
|
286
|
+
|
|
162
287
|
@Override
|
|
163
288
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
289
|
+
if (lockFocus != 0) {
|
|
290
|
+
boolean isLocked = FocusHelper.isKeyLocked(keyCode, lockFocus);
|
|
291
|
+
if (isLocked) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
164
295
|
if (focusType == FOCUS_BY_PRESS) {
|
|
165
296
|
this.reactEditText.setFocusable(false);
|
|
166
297
|
}
|
|
@@ -217,6 +348,22 @@ public class TextInputFocusWrapper extends ViewGroup implements View.OnFocusChan
|
|
|
217
348
|
}
|
|
218
349
|
}
|
|
219
350
|
|
|
351
|
+
private boolean isValidLinkedFocusTarget(View target) {
|
|
352
|
+
if (target == null || !target.isAttachedToWindow() || !this.isAttachedToWindow()) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (target.getWindowToken() == null || this.getWindowToken() == null) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (target.getWindowToken() != this.getWindowToken()) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return target.getRootView() == this.getRootView();
|
|
365
|
+
}
|
|
366
|
+
|
|
220
367
|
@Override
|
|
221
368
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
222
369
|
// No-op since UIManagerModule handles actually laying out children.
|
|
@@ -6,6 +6,8 @@ import android.view.ViewGroup;
|
|
|
6
6
|
import androidx.annotation.NonNull;
|
|
7
7
|
import androidx.annotation.Nullable;
|
|
8
8
|
|
|
9
|
+
import java.util.Objects;
|
|
10
|
+
|
|
9
11
|
import com.externalkeyboard.events.FocusChangeEvent;
|
|
10
12
|
import com.externalkeyboard.events.MultiplyTextSubmit;
|
|
11
13
|
import com.externalkeyboard.views.ExternalKeyboardView.ExternalKeyboardView;
|
|
@@ -89,6 +91,96 @@ public class TextInputFocusWrapperManager extends com.externalkeyboard.TextInput
|
|
|
89
91
|
//stub
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
@Override
|
|
95
|
+
@ReactProp(name = "orderGroup")
|
|
96
|
+
public void setOrderGroup(TextInputFocusWrapper view, @Nullable String value) {
|
|
97
|
+
if (!Objects.equals(view.getOrderGroup(), value)) {
|
|
98
|
+
view.setOrderGroup(value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Override
|
|
103
|
+
@ReactProp(name = "orderIndex")
|
|
104
|
+
public void setOrderIndex(TextInputFocusWrapper view, int value) {
|
|
105
|
+
if (!Objects.equals(view.getOrderIndex(), value)) {
|
|
106
|
+
view.setOrderIndex(value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@Override
|
|
111
|
+
@ReactProp(name = "orderId")
|
|
112
|
+
public void setOrderId(TextInputFocusWrapper view, @Nullable String value) {
|
|
113
|
+
if (!Objects.equals(view.orderId, value)) {
|
|
114
|
+
view.orderId = value;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@Override
|
|
119
|
+
@ReactProp(name = "orderLeft")
|
|
120
|
+
public void setOrderLeft(TextInputFocusWrapper view, @Nullable String value) {
|
|
121
|
+
if (!Objects.equals(view.getOrderLeft(), value)) {
|
|
122
|
+
view.setOrderLeft(value);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Override
|
|
127
|
+
@ReactProp(name = "orderRight")
|
|
128
|
+
public void setOrderRight(TextInputFocusWrapper view, @Nullable String value) {
|
|
129
|
+
if (!Objects.equals(view.getOrderRight(), value)) {
|
|
130
|
+
view.setOrderRight(value);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Override
|
|
135
|
+
@ReactProp(name = "orderUp")
|
|
136
|
+
public void setOrderUp(TextInputFocusWrapper view, @Nullable String value) {
|
|
137
|
+
if (!Objects.equals(view.getOrderUp(), value)) {
|
|
138
|
+
view.setOrderUp(value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@Override
|
|
143
|
+
@ReactProp(name = "orderDown")
|
|
144
|
+
public void setOrderDown(TextInputFocusWrapper view, @Nullable String value) {
|
|
145
|
+
if (!Objects.equals(view.getOrderDown(), value)) {
|
|
146
|
+
view.setOrderDown(value);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@Override
|
|
151
|
+
@ReactProp(name = "orderForward")
|
|
152
|
+
public void setOrderForward(TextInputFocusWrapper view, @Nullable String value) {
|
|
153
|
+
if (!Objects.equals(view.orderForward, value)) {
|
|
154
|
+
view.orderForward = value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@Override
|
|
159
|
+
@ReactProp(name = "orderBackward")
|
|
160
|
+
public void setOrderBackward(TextInputFocusWrapper view, @Nullable String value) {
|
|
161
|
+
if (!Objects.equals(view.orderBackward, value)) {
|
|
162
|
+
view.orderBackward = value;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@Override
|
|
167
|
+
@ReactProp(name = "lockFocus")
|
|
168
|
+
public void setLockFocus(TextInputFocusWrapper view, int value) {
|
|
169
|
+
if (view.lockFocus != value) {
|
|
170
|
+
view.lockFocus = value;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@Override
|
|
175
|
+
public void setOrderFirst(TextInputFocusWrapper view, @Nullable String value) {
|
|
176
|
+
//stub
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@Override
|
|
180
|
+
public void setOrderLast(TextInputFocusWrapper view, @Nullable String value) {
|
|
181
|
+
//stub
|
|
182
|
+
}
|
|
183
|
+
|
|
92
184
|
|
|
93
185
|
@Override
|
|
94
186
|
@ReactProp(name = "canBeFocused", defaultBoolean = true)
|
|
@@ -23,4 +23,28 @@ public abstract class TextInputFocusWrapperManagerSpec<T extends ViewGroup> exte
|
|
|
23
23
|
public abstract void setMultiline(TextInputFocusWrapper view, boolean value);
|
|
24
24
|
|
|
25
25
|
public abstract void setGroupIdentifier(TextInputFocusWrapper view, @Nullable String value);
|
|
26
|
+
|
|
27
|
+
public abstract void setOrderGroup(TextInputFocusWrapper view, @Nullable String value);
|
|
28
|
+
|
|
29
|
+
public abstract void setOrderIndex(TextInputFocusWrapper view, int value);
|
|
30
|
+
|
|
31
|
+
public abstract void setOrderId(TextInputFocusWrapper view, @Nullable String value);
|
|
32
|
+
|
|
33
|
+
public abstract void setOrderLeft(TextInputFocusWrapper view, @Nullable String value);
|
|
34
|
+
|
|
35
|
+
public abstract void setOrderRight(TextInputFocusWrapper view, @Nullable String value);
|
|
36
|
+
|
|
37
|
+
public abstract void setOrderUp(TextInputFocusWrapper view, @Nullable String value);
|
|
38
|
+
|
|
39
|
+
public abstract void setOrderDown(TextInputFocusWrapper view, @Nullable String value);
|
|
40
|
+
|
|
41
|
+
public abstract void setOrderForward(TextInputFocusWrapper view, @Nullable String value);
|
|
42
|
+
|
|
43
|
+
public abstract void setOrderBackward(TextInputFocusWrapper view, @Nullable String value);
|
|
44
|
+
|
|
45
|
+
public abstract void setLockFocus(TextInputFocusWrapper view, int value);
|
|
46
|
+
|
|
47
|
+
public abstract void setOrderFirst(TextInputFocusWrapper view, @Nullable String value);
|
|
48
|
+
|
|
49
|
+
public abstract void setOrderLast(TextInputFocusWrapper view, @Nullable String value);
|
|
26
50
|
}
|
|
@@ -92,8 +92,8 @@ static NSNumber *const FOCUS_UPDATE = @1;
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
- (void)keyboardedViewFocus:(UIView *)view {
|
|
95
|
-
if ([view
|
|
96
|
-
[(
|
|
95
|
+
if ([view respondsToSelector:@selector(focus)]) {
|
|
96
|
+
[(id)view focus];
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -265,12 +265,6 @@ using namespace facebook::react;
|
|
|
265
265
|
[self setHasOnFocusChanged:newViewProps.hasOnFocusChanged];
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
BOOL isLockChanged = [RNCEKVPropHelper isPropChanged:_lockFocus intValue: newViewProps.lockFocus];
|
|
269
|
-
if(isLockChanged) {
|
|
270
|
-
NSNumber* lockValue = [RNCEKVPropHelper unwrapIntValue: newViewProps.lockFocus];
|
|
271
|
-
[self setLockFocus: lockValue];
|
|
272
|
-
}
|
|
273
|
-
|
|
274
268
|
if (oldViewProps.canBeFocused != newViewProps.canBeFocused) {
|
|
275
269
|
[self setCanBeFocused:newViewProps.canBeFocused];
|
|
276
270
|
}
|
|
@@ -288,6 +282,11 @@ using namespace facebook::react;
|
|
|
288
282
|
[self setAutoFocus:hasAutoFocus];
|
|
289
283
|
}
|
|
290
284
|
|
|
285
|
+
BOOL isLockChanged = [RNCEKVPropHelper isPropChanged:_lockFocus intValue: newViewProps.lockFocus];
|
|
286
|
+
if(isLockChanged) {
|
|
287
|
+
NSNumber* lockValue = [RNCEKVPropHelper unwrapIntValue: newViewProps.lockFocus];
|
|
288
|
+
[self setLockFocus: lockValue];
|
|
289
|
+
}
|
|
291
290
|
|
|
292
291
|
BOOL isIndexChanged = [RNCEKVPropHelper isPropChanged:_orderPosition intValue: newViewProps.orderIndex];
|
|
293
292
|
if(isIndexChanged) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#import <UIKit/UIKit.h>
|
|
4
4
|
#import <React/RCTUITextField.h>
|
|
5
5
|
#import "RNCEKVGroupIdentifierProtocol.h"
|
|
6
|
+
#import "RNCEKVFocusOrderProtocol.h"
|
|
6
7
|
#import <React/RCTUITextView.h>
|
|
7
8
|
|
|
8
9
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -11,7 +12,12 @@
|
|
|
11
12
|
|
|
12
13
|
NS_ASSUME_NONNULL_BEGIN
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
#define RKNA_PROP_UPDATE(prop, setter, newProps) \
|
|
16
|
+
if ([RNCEKVPropHelper isPropChanged: _##prop stringValue: newProps.prop]) { \
|
|
17
|
+
[self setter: [RNCEKVPropHelper unwrapStringValue: newProps.prop]]; \
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@interface RNCEKVTextInputFocusWrapper : RCTViewComponentView <RNCEKVGroupIdentifierProtocol, RNCEKVFocusOrderProtocol>{
|
|
15
21
|
RCTUITextField* _textField;
|
|
16
22
|
RCTUITextView* _textView;
|
|
17
23
|
}
|
|
@@ -23,6 +29,21 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
23
29
|
@property int blurType;
|
|
24
30
|
@property BOOL multiline;
|
|
25
31
|
@property (nonatomic, strong, nullable) NSString *customGroupId;
|
|
32
|
+
|
|
33
|
+
// RNCEKVFocusOrderProtocol
|
|
34
|
+
@property (nonatomic, strong) NSString* orderGroup;
|
|
35
|
+
@property NSNumber* lockFocus;
|
|
36
|
+
@property NSNumber* orderPosition;
|
|
37
|
+
@property (nonatomic, strong) NSString* orderLeft;
|
|
38
|
+
@property (nonatomic, strong) NSString* orderRight;
|
|
39
|
+
@property (nonatomic, strong) NSString* orderUp;
|
|
40
|
+
@property (nonatomic, strong) NSString* orderDown;
|
|
41
|
+
@property NSString* orderForward;
|
|
42
|
+
@property NSString* orderBackward;
|
|
43
|
+
@property NSString* orderLast;
|
|
44
|
+
@property NSString* orderFirst;
|
|
45
|
+
@property (nonatomic, strong) NSString* orderId;
|
|
46
|
+
|
|
26
47
|
- (UIView*)getFocusTargetView;
|
|
27
48
|
|
|
28
49
|
- (void)onFocusChange:(BOOL)isFocused;
|
|
@@ -37,7 +58,7 @@ NS_ASSUME_NONNULL_END
|
|
|
37
58
|
|
|
38
59
|
|
|
39
60
|
#import <React/RCTView.h>
|
|
40
|
-
@interface RNCEKVTextInputFocusWrapper : RCTView <RNCEKVGroupIdentifierProtocol>{
|
|
61
|
+
@interface RNCEKVTextInputFocusWrapper : RCTView <RNCEKVGroupIdentifierProtocol, RNCEKVFocusOrderProtocol>{
|
|
41
62
|
RCTUITextField* _textField;
|
|
42
63
|
RCTUITextView* _textView;
|
|
43
64
|
}
|
|
@@ -51,6 +72,21 @@ NS_ASSUME_NONNULL_END
|
|
|
51
72
|
@property (nonatomic, copy) RCTDirectEventBlock onFocusChange;
|
|
52
73
|
@property (nonatomic, copy) RCTDirectEventBlock onMultiplyTextSubmit;
|
|
53
74
|
@property NSString* customGroupId;
|
|
75
|
+
|
|
76
|
+
// RNCEKVFocusOrderProtocol
|
|
77
|
+
@property (nonatomic, strong) NSString* orderGroup;
|
|
78
|
+
@property NSNumber* lockFocus;
|
|
79
|
+
@property NSNumber* orderPosition;
|
|
80
|
+
@property (nonatomic, strong) NSString* orderLeft;
|
|
81
|
+
@property (nonatomic, strong) NSString* orderRight;
|
|
82
|
+
@property (nonatomic, strong) NSString* orderUp;
|
|
83
|
+
@property (nonatomic, strong) NSString* orderDown;
|
|
84
|
+
@property NSString* orderForward;
|
|
85
|
+
@property NSString* orderBackward;
|
|
86
|
+
@property NSString* orderLast;
|
|
87
|
+
@property NSString* orderFirst;
|
|
88
|
+
@property (nonatomic, strong) NSString* orderId;
|
|
89
|
+
|
|
54
90
|
- (UIView*)getFocusTargetView;
|
|
55
91
|
|
|
56
92
|
- (void)onFocusChange:(BOOL)isFocused;
|