react-native-highlight-text-view 0.1.27 → 0.1.28

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.
@@ -206,35 +206,40 @@ class HighlightTextView : AppCompatEditText {
206
206
  charPaddingBottom = bottom
207
207
  updateViewPadding()
208
208
  applyLineHeightAndSpacing()
209
- invalidate()
209
+ requestLayout()
210
+ post { invalidate() }
210
211
  }
211
212
 
212
213
  fun setCharPaddingLeft(padding: Float) {
213
214
  charPaddingLeft = padding
214
215
  updateViewPadding()
215
216
  applyLineHeightAndSpacing()
216
- invalidate()
217
+ requestLayout()
218
+ post { invalidate() }
217
219
  }
218
220
 
219
221
  fun setCharPaddingRight(padding: Float) {
220
222
  charPaddingRight = padding
221
223
  updateViewPadding()
222
224
  applyLineHeightAndSpacing()
223
- invalidate()
225
+ requestLayout()
226
+ post { invalidate() }
224
227
  }
225
228
 
226
229
  fun setCharPaddingTop(padding: Float) {
227
230
  charPaddingTop = padding
228
231
  updateViewPadding()
229
232
  applyLineHeightAndSpacing()
230
- invalidate()
233
+ requestLayout()
234
+ post { invalidate() }
231
235
  }
232
236
 
233
237
  fun setCharPaddingBottom(padding: Float) {
234
238
  charPaddingBottom = padding
235
239
  updateViewPadding()
236
240
  applyLineHeightAndSpacing()
237
- invalidate()
241
+ requestLayout()
242
+ post { invalidate() }
238
243
  }
239
244
 
240
245
  private fun updateViewPadding() {
@@ -315,7 +320,10 @@ class HighlightTextView : AppCompatEditText {
315
320
 
316
321
  this.typeface = typeface
317
322
  applyLineHeightAndSpacing()
318
- invalidate()
323
+ // Request layout to ensure proper measurement with new font before redrawing
324
+ requestLayout()
325
+ // Post invalidate to ensure layout is complete before drawing
326
+ post { invalidate() }
319
327
  }
320
328
 
321
329
  fun setVerticalAlign(align: String?) {
@@ -359,7 +367,8 @@ class HighlightTextView : AppCompatEditText {
359
367
  fun setCustomLineHeight(lineHeight: Float) {
360
368
  customLineHeight = lineHeight
361
369
  applyLineHeightAndSpacing()
362
- invalidate()
370
+ requestLayout()
371
+ post { invalidate() }
363
372
  }
364
373
 
365
374
  fun setLetterSpacingProp(points: Float) {
@@ -372,6 +381,8 @@ class HighlightTextView : AppCompatEditText {
372
381
  super.setTextSize(unit, size)
373
382
  applyLineHeightAndSpacing()
374
383
  applyLetterSpacing()
384
+ requestLayout()
385
+ post { invalidate() }
375
386
  }
376
387
 
377
388
  fun setTextProp(newText: String) {
@@ -439,7 +439,6 @@ using namespace facebook::react;
439
439
  if (newViewProps.autoFocus && _textView.isEditable) {
440
440
  dispatch_async(dispatch_get_main_queue(), ^{
441
441
  [self->_textView becomeFirstResponder];
442
- // Move cursor to the end of the text
443
442
  NSUInteger textLength = self->_textView.text.length;
444
443
  self->_textView.selectedRange = NSMakeRange(textLength, 0);
445
444
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-highlight-text-view",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "A native text input for React Native that supports inline text highlighting",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",