react-native-external-keyboard 0.8.5-rc → 0.9.0-alpha.0
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.
Potentially problematic release.
This version of react-native-external-keyboard might be problematic. Click here for more details.
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.h +1 -1
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.h +5 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +82 -46
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderProtocol.h +6 -8
- package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.mm +60 -60
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +4 -3
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +110 -87
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -1
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +1 -1
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +15 -0
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +1 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +31 -23
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.h +1 -0
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +8 -0
- package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +123 -0
- package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +15 -0
- package/ios/Protocols/RNCEKVCustomGroudIdProtocol.h +15 -0
- package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.h +33 -0
- package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.mm +83 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +37 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +88 -0
- package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.h +49 -0
- package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.mm +200 -0
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +34 -0
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +117 -0
- package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.h +27 -0
- package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.mm +61 -0
- package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.h +30 -0
- package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.mm +82 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +33 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +102 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +36 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +63 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +75 -74
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +23 -491
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +3 -6
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.mm +12 -12
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.h +24 -22
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +21 -202
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +7 -7
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +4 -0
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +4 -0
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +4 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +4 -0
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
#import "RNCEKVGroupIdentifierProtocol.h"
|
|
6
6
|
#import "RNCEKVFocusOrderProtocol.h"
|
|
7
7
|
#import <React/RCTUITextView.h>
|
|
8
|
+
#import "RNCEKVViewGroupIdentifierBase.h"
|
|
9
|
+
#import "RNCEKVViewFocusChangeBase.h"
|
|
8
10
|
|
|
9
11
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
12
|
#import <React/RCTViewComponentView.h>
|
|
@@ -12,41 +14,41 @@
|
|
|
12
14
|
|
|
13
15
|
NS_ASSUME_NONNULL_BEGIN
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
if ([RNCEKVPropHelper isPropChanged: _##prop stringValue: newProps.prop]) { \
|
|
17
|
-
[self setter: [RNCEKVPropHelper unwrapStringValue: newProps.prop]]; \
|
|
18
|
-
}
|
|
17
|
+
//#define RKNA_PROP_UPDATE(prop, setter, newProps) \
|
|
18
|
+
//if ([RNCEKVPropHelper isPropChanged: _##prop stringValue: newProps.prop]) { \
|
|
19
|
+
//[self setter: [RNCEKVPropHelper unwrapStringValue: newProps.prop]]; \
|
|
20
|
+
//}
|
|
19
21
|
|
|
20
|
-
@interface RNCEKVTextInputFocusWrapper :
|
|
22
|
+
@interface RNCEKVTextInputFocusWrapper : RNCEKVViewFocusChangeBase <RNCEKVGroupIdentifierProtocol, RNCEKVFocusOrderProtocol>{
|
|
21
23
|
RCTUITextField* _textField;
|
|
22
24
|
RCTUITextView* _textView;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
//@property (nonatomic, strong, nullable) NSNumber *isHaloActive;
|
|
28
|
+
//@property BOOL canBeFocused;
|
|
27
29
|
@property BOOL blurOnSubmit;
|
|
28
30
|
@property int focusType;
|
|
29
31
|
@property int blurType;
|
|
30
32
|
@property BOOL multiline;
|
|
31
|
-
|
|
33
|
+
//@property (nonatomic, strong, nullable) NSString *customGroupId;
|
|
32
34
|
|
|
33
35
|
// RNCEKVFocusOrderProtocol
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
//@property (nonatomic, strong) NSString* orderGroup;
|
|
37
|
+
//@property NSNumber* lockFocus;
|
|
38
|
+
//@property NSNumber* orderPosition;
|
|
39
|
+
//@property (nonatomic, strong) NSString* orderLeft;
|
|
40
|
+
//@property (nonatomic, strong) NSString* orderRight;
|
|
41
|
+
//@property (nonatomic, strong) NSString* orderUp;
|
|
42
|
+
//@property (nonatomic, strong) NSString* orderDown;
|
|
43
|
+
//@property NSString* orderForward;
|
|
44
|
+
//@property NSString* orderBackward;
|
|
45
|
+
//@property NSString* orderLast;
|
|
46
|
+
//@property NSString* orderFirst;
|
|
47
|
+
//@property (nonatomic, strong) NSString* orderId;
|
|
46
48
|
|
|
47
49
|
- (UIView*)getFocusTargetView;
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
//- (void)onFocusChange:(BOOL)isFocused;
|
|
50
52
|
- (void)onMultiplyTextSubmitHandler;
|
|
51
53
|
|
|
52
54
|
@end
|
|
@@ -58,7 +60,7 @@ NS_ASSUME_NONNULL_END
|
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
#import <React/RCTView.h>
|
|
61
|
-
@interface RNCEKVTextInputFocusWrapper :
|
|
63
|
+
@interface RNCEKVTextInputFocusWrapper : RNCEKVViewOrderGroupBase <RNCEKVGroupIdentifierProtocol, RNCEKVFocusOrderProtocol>{
|
|
62
64
|
RCTUITextField* _textField;
|
|
63
65
|
RCTUITextView* _textView;
|
|
64
66
|
}
|
|
@@ -42,11 +42,7 @@ using namespace facebook::react;
|
|
|
42
42
|
static const NSInteger AUTO_FOCUS = 2;
|
|
43
43
|
static const NSInteger AUTO_BLUR = 2;
|
|
44
44
|
|
|
45
|
-
@implementation RNCEKVTextInputFocusWrapper
|
|
46
|
-
RNCEKVFocusOrderDelegate *_focusOrderDelegate;
|
|
47
|
-
BOOL _isLinked;
|
|
48
|
-
BOOL _isIdLinked;
|
|
49
|
-
}
|
|
45
|
+
@implementation RNCEKVTextInputFocusWrapper
|
|
50
46
|
|
|
51
47
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
52
48
|
{
|
|
@@ -55,9 +51,6 @@ static const NSInteger AUTO_BLUR = 2;
|
|
|
55
51
|
static const auto defaultProps = std::make_shared<const TextInputFocusWrapperProps>();
|
|
56
52
|
_props = defaultProps;
|
|
57
53
|
#endif
|
|
58
|
-
_focusOrderDelegate = [[RNCEKVFocusOrderDelegate alloc] initWithView:self];
|
|
59
|
-
_isLinked = NO;
|
|
60
|
-
_isIdLinked = NO;
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
return self;
|
|
@@ -70,13 +63,6 @@ static const NSInteger AUTO_BLUR = 2;
|
|
|
70
63
|
return concreteComponentDescriptorProvider<TextInputFocusWrapperComponentDescriptor>();
|
|
71
64
|
}
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- (void)setIsHaloActive:(NSNumber * _Nullable)isHaloActive {
|
|
76
|
-
_isHaloActive = isHaloActive;
|
|
77
|
-
[self updateHalo];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
66
|
- (void)prepareForRecycle
|
|
81
67
|
{
|
|
82
68
|
[super prepareForRecycle];
|
|
@@ -90,10 +76,6 @@ static const NSInteger AUTO_BLUR = 2;
|
|
|
90
76
|
[super updateProps
|
|
91
77
|
:props oldProps:oldProps];
|
|
92
78
|
|
|
93
|
-
if(oldViewProps.canBeFocused != newViewProps.canBeFocused) {
|
|
94
|
-
[self setCanBeFocused: newViewProps.canBeFocused];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
79
|
if(oldViewProps.focusType != newViewProps.focusType) {
|
|
98
80
|
[self setFocusType: newViewProps.focusType];
|
|
99
81
|
}
|
|
@@ -109,13 +91,14 @@ static const NSInteger AUTO_BLUR = 2;
|
|
|
109
91
|
if(oldViewProps.multiline != newViewProps.multiline) {
|
|
110
92
|
[self setMultiline: newViewProps.multiline];
|
|
111
93
|
}
|
|
94
|
+
|
|
95
|
+
[self updateGroupIdentifierProps:RNCEKV::GroupIdentifierProps::from(oldViewProps)
|
|
96
|
+
newProps:RNCEKV::GroupIdentifierProps::from(newViewProps)];
|
|
112
97
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
}
|
|
98
|
+
[self updateHaloProps:RNCEKV::HaloProps::from(oldViewProps)
|
|
99
|
+
newProps:RNCEKV::HaloProps::from(newViewProps)];
|
|
100
|
+
[self updateFocusOrderProps:RNCEKV::OrderProps::from(oldViewProps)
|
|
101
|
+
newProps:RNCEKV::OrderProps::from(newViewProps)];
|
|
119
102
|
|
|
120
103
|
UIColor* newColor = RCTUIColorFromSharedColor(newViewProps.tintColor);
|
|
121
104
|
BOOL renewColor = newColor != nil && self.tintColor == nil;
|
|
@@ -124,29 +107,6 @@ static const NSInteger AUTO_BLUR = 2;
|
|
|
124
107
|
self.tintColor = RCTUIColorFromSharedColor(newViewProps.tintColor);
|
|
125
108
|
}
|
|
126
109
|
|
|
127
|
-
BOOL isLockChanged = [RNCEKVPropHelper isPropChanged:_lockFocus intValue: newViewProps.lockFocus];
|
|
128
|
-
if(isLockChanged) {
|
|
129
|
-
NSNumber* lockValue = [RNCEKVPropHelper unwrapIntValue: newViewProps.lockFocus];
|
|
130
|
-
[self setLockFocus: lockValue];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
BOOL isIndexChanged = [RNCEKVPropHelper isPropChanged:_orderPosition intValue: newViewProps.orderIndex];
|
|
135
|
-
if(isIndexChanged) {
|
|
136
|
-
NSNumber* position = [RNCEKVPropHelper unwrapIntValue: newViewProps.orderIndex];
|
|
137
|
-
[self updateOrderPosition: position];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
RKNA_PROP_UPDATE(orderGroup, setOrderGroup, newViewProps);
|
|
141
|
-
RKNA_PROP_UPDATE(orderId, setOrderId, newViewProps);
|
|
142
|
-
RKNA_PROP_UPDATE(orderLeft, setOrderLeft, newViewProps);
|
|
143
|
-
RKNA_PROP_UPDATE(orderRight, setOrderRight, newViewProps);
|
|
144
|
-
RKNA_PROP_UPDATE(orderUp, setOrderUp, newViewProps);
|
|
145
|
-
RKNA_PROP_UPDATE(orderDown, setOrderDown, newViewProps);
|
|
146
|
-
RKNA_PROP_UPDATE(orderForward, setOrderForward, newViewProps);
|
|
147
|
-
RKNA_PROP_UPDATE(orderBackward, setOrderBackward, newViewProps);
|
|
148
|
-
RKNA_PROP_UPDATE(orderLast, setOrderLast, newViewProps);
|
|
149
|
-
RKNA_PROP_UPDATE(orderFirst, setOrderFirst, newViewProps);
|
|
150
110
|
}
|
|
151
111
|
|
|
152
112
|
Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
@@ -159,7 +119,7 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
159
119
|
|
|
160
120
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
161
121
|
|
|
162
|
-
- (void)
|
|
122
|
+
- (void)onFocusChangeHandler:(BOOL) isFocused {
|
|
163
123
|
if (_eventEmitter) {
|
|
164
124
|
auto viewEventEmitter = std::static_pointer_cast<TextInputFocusWrapperEventEmitter const>(_eventEmitter);
|
|
165
125
|
facebook::react::TextInputFocusWrapperEventEmitter::OnFocusChange data = {
|
|
@@ -183,7 +143,7 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
183
143
|
#else
|
|
184
144
|
|
|
185
145
|
|
|
186
|
-
- (void)
|
|
146
|
+
- (void)onFocusChangeHandler:(BOOL) isFocused {
|
|
187
147
|
if(self.onFocusChange) {
|
|
188
148
|
self.onFocusChange(@{ @"isFocused": @(isFocused) });
|
|
189
149
|
}
|
|
@@ -198,7 +158,6 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
198
158
|
|
|
199
159
|
#endif
|
|
200
160
|
|
|
201
|
-
|
|
202
161
|
- (void)focus {
|
|
203
162
|
UIViewController *viewController = self.reactViewController;
|
|
204
163
|
[self updateFocus:viewController];
|
|
@@ -206,105 +165,19 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
206
165
|
|
|
207
166
|
- (void)updateFocus:(UIViewController *)controller {
|
|
208
167
|
UIView *focusingView = self.subviews.count ? self.subviews[0] : nil;
|
|
209
|
-
|
|
210
168
|
if (self.superview != nil && controller != nil) {
|
|
211
|
-
controller
|
|
212
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
213
|
-
[controller setNeedsFocusUpdate];
|
|
214
|
-
[controller updateFocusIfNeeded];
|
|
215
|
-
});
|
|
169
|
+
[controller rncekvFocusView:focusingView];
|
|
216
170
|
}
|
|
217
171
|
}
|
|
218
172
|
|
|
219
|
-
// Focus order linking
|
|
220
|
-
|
|
221
|
-
- (void)link {
|
|
222
|
-
if(_orderPosition != nil && _orderGroup != nil && !_isLinked) {
|
|
223
|
-
[[RNCEKVOrderLinking sharedInstance] add: _orderPosition withOrderKey: _orderGroup withObject:self];
|
|
224
|
-
_isLinked = YES;
|
|
225
|
-
}
|
|
226
|
-
if(_orderId != nil) {
|
|
227
|
-
[[RNCEKVOrderLinking sharedInstance] storeOrderId:_orderId withView: self];
|
|
228
|
-
[_focusOrderDelegate linkId];
|
|
229
|
-
_isIdLinked = YES;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
- (void)unlink {
|
|
234
|
-
if(_orderPosition != nil && _orderGroup != nil && _isLinked) {
|
|
235
|
-
[[RNCEKVOrderLinking sharedInstance] remove:_orderPosition withOrderKey: _orderGroup];
|
|
236
|
-
}
|
|
237
|
-
if(_orderId != nil) {
|
|
238
|
-
[[RNCEKVOrderLinking sharedInstance] cleanOrderId:_orderId];
|
|
239
|
-
[_focusOrderDelegate clear];
|
|
240
|
-
}
|
|
241
|
-
_isLinked = NO;
|
|
242
|
-
_isIdLinked = NO;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
- (void)setOrderGroup:(NSString *)orderGroup {
|
|
246
|
-
if(_orderPosition != nil && self.superview != nil) {
|
|
247
|
-
[[RNCEKVOrderLinking sharedInstance] updateOrderKey:(NSString *)_orderGroup next:orderGroup position:_orderPosition withView: self];
|
|
248
|
-
}
|
|
249
|
-
_orderGroup = orderGroup;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
- (void)setOrderId:(NSString *)next {
|
|
253
|
-
[_focusOrderDelegate refreshId:_orderId next:next];
|
|
254
|
-
_orderId = next;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
- (void)setOrderLeft:(NSString *)orderLeft {
|
|
258
|
-
[_focusOrderDelegate refreshLeft: _orderLeft next: orderLeft];
|
|
259
|
-
_orderLeft = orderLeft;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
- (void)setOrderRight:(NSString *)orderRight {
|
|
263
|
-
[_focusOrderDelegate refreshRight: _orderRight next: orderRight];
|
|
264
|
-
_orderRight = orderRight;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
- (void)setOrderUp:(NSString *)orderUp {
|
|
268
|
-
[_focusOrderDelegate refreshUp: _orderUp next: orderUp];
|
|
269
|
-
_orderUp = orderUp;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
- (void)setOrderDown:(NSString *)orderDown {
|
|
273
|
-
[_focusOrderDelegate refreshDown: _orderDown next: orderDown];
|
|
274
|
-
_orderDown = orderDown;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
- (void)updateOrderPosition:(NSNumber *)position {
|
|
278
|
-
if(_orderPosition != nil || _orderPosition != position) {
|
|
279
|
-
if(_orderGroup != nil && self.superview != nil && _isLinked) {
|
|
280
|
-
[[RNCEKVOrderLinking sharedInstance] update:position lastPosition:_orderPosition withOrderKey: _orderGroup withView: self];
|
|
281
|
-
}
|
|
282
|
-
_orderPosition = position;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if(_orderPosition == nil && _orderPosition != position) {
|
|
286
|
-
_orderPosition = position;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
- (BOOL)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context {
|
|
291
|
-
if(!_orderGroup && !_orderPosition && !_lockFocus && !_orderForward && !_orderBackward) {
|
|
292
|
-
return [super shouldUpdateFocusInContext: context];
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
NSNumber* result = [_focusOrderDelegate shouldUpdateFocusInContext: context];
|
|
296
|
-
if(result == nil) {
|
|
297
|
-
return [super shouldUpdateFocusInContext: context];
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return result.boolValue;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// ToDo RNCEKV-3, if we return yes here, it means that wrapper is focusable, with current implementation it works as expected, but it would be better to double check
|
|
304
173
|
- (BOOL)canBecomeFocused {
|
|
305
174
|
return NO;
|
|
306
175
|
}
|
|
307
176
|
|
|
177
|
+
- (UIView*)getStoredView {
|
|
178
|
+
return _textField;
|
|
179
|
+
}
|
|
180
|
+
|
|
308
181
|
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
|
|
309
182
|
withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
|
|
310
183
|
|
|
@@ -316,8 +189,6 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
316
189
|
BOOL isPrev = context.previouslyFocusedView == _textField;
|
|
317
190
|
|
|
318
191
|
if(isNext) {
|
|
319
|
-
[self onFocusChange: YES];
|
|
320
|
-
[_focusOrderDelegate setIsFocused: YES];
|
|
321
192
|
if(self.focusType == AUTO_FOCUS) {
|
|
322
193
|
if(_textField != nil) {
|
|
323
194
|
[_textField reactFocus];
|
|
@@ -326,14 +197,14 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
326
197
|
}
|
|
327
198
|
|
|
328
199
|
if(isPrev) {
|
|
329
|
-
[self onFocusChange: NO];
|
|
330
|
-
[_focusOrderDelegate setIsFocused: NO];
|
|
331
200
|
if(self.blurType == AUTO_BLUR) {
|
|
332
201
|
if(_textField != nil) {
|
|
333
202
|
[_textField reactBlur];
|
|
334
203
|
}
|
|
335
204
|
}
|
|
336
205
|
}
|
|
206
|
+
|
|
207
|
+
[super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
|
|
337
208
|
}
|
|
338
209
|
|
|
339
210
|
- (UIView*)getTextFieldComponent {
|
|
@@ -360,27 +231,9 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
360
231
|
}
|
|
361
232
|
|
|
362
233
|
- (void)cleanReferences{
|
|
234
|
+
[super cleanReferences];
|
|
363
235
|
_textField = nil;
|
|
364
236
|
_textView = nil;
|
|
365
|
-
_customGroupId = nil;
|
|
366
|
-
[self unlink];
|
|
367
|
-
_orderGroup = nil;
|
|
368
|
-
_orderPosition = nil;
|
|
369
|
-
_orderLeft = nil;
|
|
370
|
-
_orderRight = nil;
|
|
371
|
-
_orderUp = nil;
|
|
372
|
-
_orderDown = nil;
|
|
373
|
-
_orderForward = nil;
|
|
374
|
-
_orderBackward = nil;
|
|
375
|
-
_orderLast = nil;
|
|
376
|
-
_orderFirst = nil;
|
|
377
|
-
_orderId = nil;
|
|
378
|
-
_lockFocus = nil;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
-(BOOL)isHaloHidden {
|
|
382
|
-
NSNumber* isHaloActive = [self isHaloActive];
|
|
383
|
-
return [isHaloActive isEqual: @NO];
|
|
384
237
|
}
|
|
385
238
|
|
|
386
239
|
- (BOOL)getIsTextInputView: (UIView*)view {
|
|
@@ -392,29 +245,6 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
392
245
|
return isTextInput;
|
|
393
246
|
}
|
|
394
247
|
|
|
395
|
-
- (void)updateHalo {
|
|
396
|
-
if(self.subviews.count == 0) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
UIView* view = self.subviews[0];
|
|
401
|
-
if (@available(iOS 15.0, *)) {
|
|
402
|
-
BOOL isTextInput = [self getIsTextInputView: view];
|
|
403
|
-
if(isTextInput) {
|
|
404
|
-
UIFocusEffect* focusEffect = [self isHaloHidden] ? [RNCEKVFocusEffectUtility emptyFocusEffect] : nil;
|
|
405
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
406
|
-
if([view.subviews[0] isKindOfClass: RCTViewComponentView.class]) {
|
|
407
|
-
((RCTViewComponentView*)view.subviews[0]).rncekvCustomFocusEffect = focusEffect;
|
|
408
|
-
} else {
|
|
409
|
-
view.subviews[0].focusEffect = focusEffect;
|
|
410
|
-
}
|
|
411
|
-
#else
|
|
412
|
-
view.subviews[0].focusEffect = focusEffect;
|
|
413
|
-
#endif
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
248
|
- (void)pressesBegan:(NSSet<UIPress *> *)presses
|
|
419
249
|
withEvent:(UIPressesEvent *)event {
|
|
420
250
|
if (@available(iOS 13.4, *)) {
|
|
@@ -444,22 +274,11 @@ Class<RCTComponentViewProtocol> TextInputFocusWrapperCls(void)
|
|
|
444
274
|
[super pressesBegan:presses withEvent:event];
|
|
445
275
|
}
|
|
446
276
|
|
|
447
|
-
// ToDo, check if needed
|
|
448
|
-
- (void)didMoveToWindow {
|
|
449
|
-
#ifndef RCT_NEW_ARCH_ENABLED
|
|
450
|
-
[self updateHalo];
|
|
451
|
-
#endif
|
|
452
|
-
|
|
453
|
-
if (self.window) {
|
|
454
|
-
[self link];
|
|
455
|
-
} else {
|
|
456
|
-
[self unlink];
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
277
|
|
|
462
278
|
- (UIView*)getFocusTargetView {
|
|
279
|
+
if(_textField != nil) {
|
|
280
|
+
return _textField;
|
|
281
|
+
}
|
|
463
282
|
if(self.subviews.count > 0 && self.subviews[0].subviews.count > 0) {
|
|
464
283
|
UIView* focusingView = self.subviews[0].subviews[0];
|
|
465
284
|
return focusingView;
|
|
@@ -56,13 +56,13 @@ RCT_CUSTOM_VIEW_PROPERTY(blurType, int, RNCEKVTextInputFocusWrapper)
|
|
|
56
56
|
RCT_CUSTOM_VIEW_PROPERTY(haloEffect, BOOL, RNCEKVTextInputFocusWrapper)
|
|
57
57
|
{
|
|
58
58
|
if(json) {
|
|
59
|
-
BOOL value = [RCTConvert BOOL:json];
|
|
60
|
-
if(view.isHaloActive == nil && !value) {
|
|
61
|
-
[view setIsHaloActive: @0];
|
|
62
|
-
}
|
|
63
|
-
if(view.isHaloActive != nil) {
|
|
64
|
-
[view setIsHaloActive: @(value)];
|
|
65
|
-
}
|
|
59
|
+
// BOOL value = [RCTConvert BOOL:json];
|
|
60
|
+
// if(view.isHaloActive == nil && !value) {
|
|
61
|
+
// [view setIsHaloActive: @0];
|
|
62
|
+
// }
|
|
63
|
+
// if(view.isHaloActive != nil) {
|
|
64
|
+
// [view setIsHaloActive: @(value)];
|
|
65
|
+
// }
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
2
2
|
import type {
|
|
3
3
|
DirectEventHandler,
|
|
4
|
+
Float,
|
|
4
5
|
Int32,
|
|
5
6
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
7
|
// eslint-disable-next-line @react-native/no-deep-imports
|
|
@@ -21,6 +22,9 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
21
22
|
blurType?: Int32;
|
|
22
23
|
canBeFocused?: boolean;
|
|
23
24
|
haloEffect?: boolean;
|
|
25
|
+
haloCornerRadius?: Float;
|
|
26
|
+
haloExpendX?: Float;
|
|
27
|
+
haloExpendY?: Float;
|
|
24
28
|
tintColor?: ColorValue;
|
|
25
29
|
blurOnSubmit?: boolean;
|
|
26
30
|
multiline?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
2
2
|
import type {
|
|
3
3
|
DirectEventHandler,
|
|
4
|
+
Float,
|
|
4
5
|
Int32,
|
|
5
6
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
7
|
// eslint-disable-next-line @react-native/no-deep-imports
|
|
@@ -21,6 +22,9 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
21
22
|
blurType?: Int32;
|
|
22
23
|
canBeFocused?: boolean;
|
|
23
24
|
haloEffect?: boolean;
|
|
25
|
+
haloCornerRadius?: Float;
|
|
26
|
+
haloExpendX?: Float;
|
|
27
|
+
haloExpendY?: Float;
|
|
24
28
|
tintColor?: ColorValue;
|
|
25
29
|
blurOnSubmit?: boolean;
|
|
26
30
|
multiline?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
2
|
-
import type { DirectEventHandler, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
2
|
+
import type { DirectEventHandler, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
3
|
export type FocusChange = Readonly<{
|
|
4
4
|
isFocused: boolean;
|
|
5
5
|
}>;
|
|
@@ -13,6 +13,9 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
13
13
|
blurType?: Int32;
|
|
14
14
|
canBeFocused?: boolean;
|
|
15
15
|
haloEffect?: boolean;
|
|
16
|
+
haloCornerRadius?: Float;
|
|
17
|
+
haloExpendX?: Float;
|
|
18
|
+
haloExpendY?: Float;
|
|
16
19
|
tintColor?: ColorValue;
|
|
17
20
|
blurOnSubmit?: boolean;
|
|
18
21
|
multiline?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputFocusWrapperNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpec/TextInputFocusWrapperNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACN,MAAM,2CAA2C,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,oCAAqC,SAAQ,SAAS;IACrE,aAAa,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChD,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;AAED,wBAEE"}
|
|
1
|
+
{"version":3,"file":"TextInputFocusWrapperNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpec/TextInputFocusWrapperNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,KAAK,EACN,MAAM,2CAA2C,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,oCAAqC,SAAQ,SAAS;IACrE,aAAa,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChD,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;AAED,wBAEE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
2
2
|
import type {
|
|
3
3
|
DirectEventHandler,
|
|
4
|
+
Float,
|
|
4
5
|
Int32,
|
|
5
6
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
7
|
// eslint-disable-next-line @react-native/no-deep-imports
|
|
@@ -21,6 +22,9 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
21
22
|
blurType?: Int32;
|
|
22
23
|
canBeFocused?: boolean;
|
|
23
24
|
haloEffect?: boolean;
|
|
25
|
+
haloCornerRadius?: Float;
|
|
26
|
+
haloExpendX?: Float;
|
|
27
|
+
haloExpendY?: Float;
|
|
24
28
|
tintColor?: ColorValue;
|
|
25
29
|
blurOnSubmit?: boolean;
|
|
26
30
|
multiline?: boolean;
|