react-native-transformer-text-input 0.1.0-alpha.4 → 0.1.0-alpha.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.
@@ -150,7 +150,11 @@ struct RNTTITextState {
150
150
  [textInputComponentView valueForKey:@"_backedTextInputView"];
151
151
 
152
152
  _backedTextInput = backedTextInputView;
153
- _baseDelegate = backedTextInputView.textInputDelegate;
153
+ id<RCTBackedTextInputDelegate> currentDelegate = backedTextInputView.textInputDelegate;
154
+ // Guard against setting ourselves as baseDelegate (would cause infinite recursion)
155
+ if (currentDelegate != self) {
156
+ _baseDelegate = currentDelegate;
157
+ }
154
158
  backedTextInputView.textInputDelegate = self;
155
159
 
156
160
  _observersAdded = true;
@@ -158,6 +162,9 @@ struct RNTTITextState {
158
162
 
159
163
  - (void)removeTextInputObservers
160
164
  {
165
+ if (_backedTextInput && _baseDelegate) {
166
+ _backedTextInput.textInputDelegate = _baseDelegate;
167
+ }
161
168
  _backedTextInput = nil;
162
169
  _baseDelegate = nil;
163
170
  _observersAdded = false;
@@ -204,7 +211,11 @@ struct RNTTITextState {
204
211
 
205
212
  - (BOOL)textInputShouldBeginEditing
206
213
  {
207
- return [_baseDelegate textInputShouldBeginEditing];
214
+ id<RCTBackedTextInputDelegate> delegate = _baseDelegate;
215
+ if (delegate == nil || delegate == self) {
216
+ return YES;
217
+ }
218
+ return [delegate textInputShouldBeginEditing];
208
219
  }
209
220
 
210
221
  - (nonnull NSString *)textInputShouldChangeText:(nonnull NSString *)text inRange:(NSRange)range