react-native-typerich 0.1.12 → 0.1.14
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.
|
@@ -45,7 +45,6 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
45
45
|
lateinit var layoutManager: TypeRichTextInputViewLayoutManager
|
|
46
46
|
|
|
47
47
|
var isDuringTransaction: Boolean = false
|
|
48
|
-
var isRemovingMany: Boolean = false
|
|
49
48
|
var scrollEnabled: Boolean = true
|
|
50
49
|
|
|
51
50
|
var experimentalSynchronousEvents: Boolean = false
|
|
@@ -60,10 +59,11 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
60
59
|
private var fontWeight: Int = ReactConstants.UNSET
|
|
61
60
|
private var defaultValue: CharSequence? = null
|
|
62
61
|
private var defaultValueDirty: Boolean = false
|
|
63
|
-
private var keyboardAppearance: String = "default"
|
|
62
|
+
// private var keyboardAppearance: String = "default" // used in ios only
|
|
64
63
|
private var inputMethodManager: InputMethodManager? = null
|
|
65
64
|
private var lineHeightPx: Int? = null
|
|
66
65
|
private var isSettingTextFromJS = false
|
|
66
|
+
private var isInitialized = false
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
constructor(context: Context) : super(context) {
|
|
@@ -106,8 +106,14 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
106
106
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { if (isSettingTextFromJS) return}
|
|
107
107
|
|
|
108
108
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
|
109
|
-
if (
|
|
110
|
-
|
|
109
|
+
if (isSettingTextFromJS) return
|
|
110
|
+
|
|
111
|
+
if (!isInitialized) {
|
|
112
|
+
layoutManager.invalidateLayout()
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!isDuringTransaction ) {
|
|
111
117
|
|
|
112
118
|
val reactContext = context as ReactContext
|
|
113
119
|
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
|
|
@@ -295,6 +301,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
295
301
|
|
|
296
302
|
override fun onSelectionChanged(selStart: Int, selEnd: Int) {
|
|
297
303
|
super.onSelectionChanged(selStart, selEnd)
|
|
304
|
+
if (isDuringTransaction) return
|
|
298
305
|
|
|
299
306
|
val reactContext = context as? ReactContext ?: return
|
|
300
307
|
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
|
|
@@ -411,6 +418,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
411
418
|
}
|
|
412
419
|
} finally {
|
|
413
420
|
isSettingTextFromJS = false
|
|
421
|
+
layoutManager.invalidateLayout()
|
|
414
422
|
}
|
|
415
423
|
}
|
|
416
424
|
|
|
@@ -546,6 +554,8 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
546
554
|
updateTypeface()
|
|
547
555
|
updateDefaultValue()
|
|
548
556
|
applyLineHeight()
|
|
557
|
+
|
|
558
|
+
isInitialized = true
|
|
549
559
|
}
|
|
550
560
|
|
|
551
561
|
fun setDefaultValue(value: CharSequence?) {
|
|
@@ -556,7 +566,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
556
566
|
private fun updateDefaultValue() {
|
|
557
567
|
if (!defaultValueDirty) return
|
|
558
568
|
defaultValueDirty = false
|
|
559
|
-
|
|
569
|
+
setValue(defaultValue)
|
|
560
570
|
}
|
|
561
571
|
|
|
562
572
|
private fun updateTypeface() {
|