react-native-enriched 0.2.0 → 0.3.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.
- package/README.md +16 -17
- package/android/build.gradle +77 -72
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +21 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +7 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.cpp +156 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h +147 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.cpp +10 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.h +194 -0
- package/android/lint.gradle +70 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputConnectionWrapper.kt +140 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +304 -83
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewLayoutManager.kt +3 -1
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt +166 -51
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewPackage.kt +1 -3
- package/android/src/main/java/com/swmansion/enriched/MeasurementStore.kt +70 -21
- package/android/src/main/java/com/swmansion/enriched/events/MentionHandler.kt +21 -11
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeHtmlEvent.kt +8 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeSelectionEvent.kt +10 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateDeprecatedEvent.kt +21 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateEvent.kt +9 -12
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeTextEvent.kt +10 -10
- package/android/src/main/java/com/swmansion/enriched/events/OnInputBlurEvent.kt +7 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnInputFocusEvent.kt +7 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnInputKeyPressEvent.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnLinkDetectedEvent.kt +13 -11
- package/android/src/main/java/com/swmansion/enriched/events/OnMentionDetectedEvent.kt +10 -9
- package/android/src/main/java/com/swmansion/enriched/events/OnMentionEvent.kt +9 -8
- package/android/src/main/java/com/swmansion/enriched/events/OnRequestHtmlResultEvent.kt +32 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBlockQuoteSpan.kt +24 -5
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBoldSpan.kt +8 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedCodeBlockSpan.kt +10 -2
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH1Span.kt +8 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH2Span.kt +8 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH3Span.kt +8 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH4Span.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH5Span.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH6Span.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedImageSpan.kt +34 -17
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedInlineCodeSpan.kt +8 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedItalicSpan.kt +7 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedLinkSpan.kt +10 -4
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedMentionSpan.kt +14 -11
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedOrderedListSpan.kt +18 -11
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedSpans.kt +174 -72
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedStrikeThroughSpan.kt +7 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnderlineSpan.kt +7 -1
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnorderedListSpan.kt +11 -5
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedBlockSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedHeadingSpan.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedInlineSpan.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedParagraphSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedSpan.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +1 -2
- package/android/src/main/java/com/swmansion/enriched/spans/utils/ForceRedrawSpan.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/styles/HtmlStyle.kt +155 -20
- package/android/src/main/java/com/swmansion/enriched/styles/InlineStyles.kt +25 -8
- package/android/src/main/java/com/swmansion/enriched/styles/ListStyles.kt +60 -20
- package/android/src/main/java/com/swmansion/enriched/styles/ParagraphStyles.kt +161 -25
- package/android/src/main/java/com/swmansion/enriched/styles/ParametrizedStyles.kt +128 -52
- package/android/src/main/java/com/swmansion/enriched/utils/AsyncDrawable.kt +10 -7
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedConstants.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedEditableFactory.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedParser.java +136 -87
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSelection.kt +71 -42
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpanState.kt +183 -48
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpannable.kt +82 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpannableStringBuilder.kt +15 -0
- package/android/src/main/java/com/swmansion/enriched/utils/Utils.kt +0 -70
- package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedSpanWatcher.kt +46 -14
- package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedTextWatcher.kt +34 -11
- package/android/src/main/new_arch/CMakeLists.txt +6 -0
- package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.cpp +6 -6
- package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.h +6 -6
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputComponentDescriptor.h +19 -19
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.cpp +40 -51
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.h +13 -15
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.cpp +23 -21
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.h +35 -36
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.cpp +4 -4
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.h +13 -14
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/conversions.h +33 -14
- package/ios/EnrichedTextInputView.h +26 -14
- package/ios/EnrichedTextInputView.mm +1209 -586
- package/ios/config/InputConfig.h +24 -6
- package/ios/config/InputConfig.mm +154 -38
- package/ios/{utils → extensions}/ColorExtension.mm +7 -5
- package/ios/extensions/FontExtension.mm +106 -0
- package/ios/{utils → extensions}/LayoutManagerExtension.h +1 -1
- package/ios/extensions/LayoutManagerExtension.mm +396 -0
- package/ios/{utils → extensions}/StringExtension.mm +19 -16
- package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.cpp +156 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.h +147 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/Props.cpp +10 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/Props.h +194 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/RCTComponentViewHelpers.h +95 -0
- package/ios/inputParser/InputParser.h +5 -5
- package/ios/inputParser/InputParser.mm +864 -380
- package/ios/inputTextView/InputTextView.h +1 -1
- package/ios/inputTextView/InputTextView.mm +100 -59
- package/ios/{utils → interfaces}/BaseStyleProtocol.h +2 -2
- package/ios/interfaces/ImageAttachment.h +10 -0
- package/ios/interfaces/ImageAttachment.mm +36 -0
- package/ios/interfaces/LinkRegexConfig.h +19 -0
- package/ios/interfaces/LinkRegexConfig.mm +37 -0
- package/ios/interfaces/MediaAttachment.h +23 -0
- package/ios/interfaces/MediaAttachment.mm +31 -0
- package/ios/{utils → interfaces}/MentionParams.h +0 -1
- package/ios/{utils → interfaces}/MentionStyleProps.mm +27 -20
- package/ios/{utils → interfaces}/StyleHeaders.h +37 -15
- package/ios/{utils → interfaces}/StyleTypeEnum.h +3 -0
- package/ios/internals/EnrichedTextInputViewComponentDescriptor.h +11 -9
- package/ios/internals/EnrichedTextInputViewShadowNode.h +28 -25
- package/ios/internals/EnrichedTextInputViewShadowNode.mm +45 -40
- package/ios/internals/EnrichedTextInputViewState.h +3 -1
- package/ios/styles/BlockQuoteStyle.mm +189 -118
- package/ios/styles/BoldStyle.mm +110 -63
- package/ios/styles/CodeBlockStyle.mm +204 -128
- package/ios/styles/H1Style.mm +10 -4
- package/ios/styles/H2Style.mm +10 -4
- package/ios/styles/H3Style.mm +10 -4
- package/ios/styles/H4Style.mm +17 -0
- package/ios/styles/H5Style.mm +17 -0
- package/ios/styles/H6Style.mm +17 -0
- package/ios/styles/HeadingStyleBase.mm +148 -86
- package/ios/styles/ImageStyle.mm +75 -73
- package/ios/styles/InlineCodeStyle.mm +162 -88
- package/ios/styles/ItalicStyle.mm +76 -52
- package/ios/styles/LinkStyle.mm +411 -232
- package/ios/styles/MentionStyle.mm +363 -246
- package/ios/styles/OrderedListStyle.mm +171 -106
- package/ios/styles/StrikethroughStyle.mm +52 -35
- package/ios/styles/UnderlineStyle.mm +68 -46
- package/ios/styles/UnorderedListStyle.mm +169 -106
- package/ios/utils/OccurenceUtils.h +42 -42
- package/ios/utils/OccurenceUtils.mm +142 -119
- package/ios/utils/ParagraphAttributesUtils.h +10 -2
- package/ios/utils/ParagraphAttributesUtils.mm +182 -71
- package/ios/utils/ParagraphsUtils.h +2 -1
- package/ios/utils/ParagraphsUtils.mm +41 -27
- package/ios/utils/TextInsertionUtils.h +13 -2
- package/ios/utils/TextInsertionUtils.mm +38 -20
- package/ios/utils/WordsUtils.h +2 -1
- package/ios/utils/WordsUtils.mm +32 -22
- package/ios/utils/ZeroWidthSpaceUtils.h +3 -1
- package/ios/utils/ZeroWidthSpaceUtils.mm +145 -79
- package/lib/module/EnrichedTextInput.js +61 -2
- package/lib/module/EnrichedTextInput.js.map +1 -1
- package/lib/module/EnrichedTextInputNativeComponent.ts +149 -12
- package/lib/module/{normalizeHtmlStyle.js → utils/normalizeHtmlStyle.js} +12 -0
- package/lib/module/utils/normalizeHtmlStyle.js.map +1 -0
- package/lib/module/utils/regexParser.js +46 -0
- package/lib/module/utils/regexParser.js.map +1 -0
- package/lib/typescript/src/EnrichedTextInput.d.ts +24 -14
- package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts +129 -12
- package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts +4 -0
- package/lib/typescript/src/utils/normalizeHtmlStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/regexParser.d.ts +3 -0
- package/lib/typescript/src/utils/regexParser.d.ts.map +1 -0
- package/package.json +17 -6
- package/src/EnrichedTextInput.tsx +96 -13
- package/src/EnrichedTextInputNativeComponent.ts +149 -12
- package/src/index.tsx +2 -0
- package/src/{normalizeHtmlStyle.ts → utils/normalizeHtmlStyle.ts} +14 -2
- package/src/utils/regexParser.ts +56 -0
- package/ios/utils/FontExtension.mm +0 -91
- package/ios/utils/LayoutManagerExtension.mm +0 -286
- package/lib/module/normalizeHtmlStyle.js.map +0 -1
- package/lib/typescript/src/normalizeHtmlStyle.d.ts +0 -4
- package/lib/typescript/src/normalizeHtmlStyle.d.ts.map +0 -1
- package/ios/{utils → extensions}/ColorExtension.h +0 -0
- package/ios/{utils → extensions}/FontExtension.h +0 -0
- package/ios/{utils → extensions}/StringExtension.h +1 -1
- package/ios/{utils → interfaces}/ImageData.h +0 -0
- package/ios/{utils → interfaces}/ImageData.mm +0 -0
- package/ios/{utils → interfaces}/LinkData.h +0 -0
- package/ios/{utils → interfaces}/LinkData.mm +0 -0
- package/ios/{utils → interfaces}/MentionParams.mm +0 -0
- package/ios/{utils → interfaces}/MentionStyleProps.h +1 -1
- /package/ios/{utils → interfaces}/StylePair.h +0 -0
- /package/ios/{utils → interfaces}/StylePair.mm +0 -0
- /package/ios/{utils → interfaces}/TextDecorationLineEnum.h +0 -0
- /package/ios/{utils → interfaces}/TextDecorationLineEnum.mm +0 -0
|
@@ -15,36 +15,34 @@ import com.facebook.react.uimanager.annotations.ReactProp
|
|
|
15
15
|
import com.facebook.react.viewmanagers.EnrichedTextInputViewManagerDelegate
|
|
16
16
|
import com.facebook.react.viewmanagers.EnrichedTextInputViewManagerInterface
|
|
17
17
|
import com.facebook.yoga.YogaMeasureMode
|
|
18
|
-
import com.swmansion.enriched.events.OnInputBlurEvent
|
|
19
18
|
import com.swmansion.enriched.events.OnChangeHtmlEvent
|
|
20
19
|
import com.swmansion.enriched.events.OnChangeSelectionEvent
|
|
20
|
+
import com.swmansion.enriched.events.OnChangeStateDeprecatedEvent
|
|
21
21
|
import com.swmansion.enriched.events.OnChangeStateEvent
|
|
22
22
|
import com.swmansion.enriched.events.OnChangeTextEvent
|
|
23
|
+
import com.swmansion.enriched.events.OnInputBlurEvent
|
|
23
24
|
import com.swmansion.enriched.events.OnInputFocusEvent
|
|
25
|
+
import com.swmansion.enriched.events.OnInputKeyPressEvent
|
|
24
26
|
import com.swmansion.enriched.events.OnLinkDetectedEvent
|
|
25
27
|
import com.swmansion.enriched.events.OnMentionDetectedEvent
|
|
26
28
|
import com.swmansion.enriched.events.OnMentionEvent
|
|
29
|
+
import com.swmansion.enriched.events.OnRequestHtmlResultEvent
|
|
27
30
|
import com.swmansion.enriched.spans.EnrichedSpans
|
|
28
31
|
import com.swmansion.enriched.styles.HtmlStyle
|
|
29
32
|
import com.swmansion.enriched.utils.jsonStringToStringMap
|
|
30
33
|
|
|
31
34
|
@ReactModule(name = EnrichedTextInputViewManager.NAME)
|
|
32
|
-
class EnrichedTextInputViewManager :
|
|
35
|
+
class EnrichedTextInputViewManager :
|
|
36
|
+
SimpleViewManager<EnrichedTextInputView>(),
|
|
33
37
|
EnrichedTextInputViewManagerInterface<EnrichedTextInputView> {
|
|
34
38
|
private val mDelegate: ViewManagerDelegate<EnrichedTextInputView> =
|
|
35
39
|
EnrichedTextInputViewManagerDelegate(this)
|
|
36
40
|
|
|
37
|
-
override fun getDelegate(): ViewManagerDelegate<EnrichedTextInputView>?
|
|
38
|
-
return mDelegate
|
|
39
|
-
}
|
|
41
|
+
override fun getDelegate(): ViewManagerDelegate<EnrichedTextInputView>? = mDelegate
|
|
40
42
|
|
|
41
|
-
override fun getName(): String
|
|
42
|
-
return NAME
|
|
43
|
-
}
|
|
43
|
+
override fun getName(): String = NAME
|
|
44
44
|
|
|
45
|
-
public override fun createViewInstance(context: ThemedReactContext): EnrichedTextInputView
|
|
46
|
-
return EnrichedTextInputView(context)
|
|
47
|
-
}
|
|
45
|
+
public override fun createViewInstance(context: ThemedReactContext): EnrichedTextInputView = EnrichedTextInputView(context)
|
|
48
46
|
|
|
49
47
|
override fun onDropViewInstance(view: EnrichedTextInputView) {
|
|
50
48
|
super.onDropViewInstance(view)
|
|
@@ -54,64 +52,91 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
54
52
|
override fun updateState(
|
|
55
53
|
view: EnrichedTextInputView,
|
|
56
54
|
props: ReactStylesDiffMap?,
|
|
57
|
-
stateWrapper: StateWrapper
|
|
55
|
+
stateWrapper: StateWrapper?,
|
|
58
56
|
): Any? {
|
|
59
57
|
view.stateWrapper = stateWrapper
|
|
60
58
|
return super.updateState(view, props, stateWrapper)
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
|
|
62
|
+
val map = mutableMapOf<String, Any>()
|
|
63
|
+
map.put(OnInputFocusEvent.EVENT_NAME, mapOf("registrationName" to OnInputFocusEvent.EVENT_NAME))
|
|
64
|
+
map.put(OnInputBlurEvent.EVENT_NAME, mapOf("registrationName" to OnInputBlurEvent.EVENT_NAME))
|
|
65
|
+
map.put(OnChangeTextEvent.EVENT_NAME, mapOf("registrationName" to OnChangeTextEvent.EVENT_NAME))
|
|
66
|
+
map.put(OnChangeHtmlEvent.EVENT_NAME, mapOf("registrationName" to OnChangeHtmlEvent.EVENT_NAME))
|
|
67
|
+
map.put(OnChangeStateEvent.EVENT_NAME, mapOf("registrationName" to OnChangeStateEvent.EVENT_NAME))
|
|
68
|
+
map.put(OnChangeStateDeprecatedEvent.EVENT_NAME, mapOf("registrationName" to OnChangeStateDeprecatedEvent.EVENT_NAME))
|
|
69
|
+
map.put(OnLinkDetectedEvent.EVENT_NAME, mapOf("registrationName" to OnLinkDetectedEvent.EVENT_NAME))
|
|
70
|
+
map.put(OnMentionDetectedEvent.EVENT_NAME, mapOf("registrationName" to OnMentionDetectedEvent.EVENT_NAME))
|
|
71
|
+
map.put(OnMentionEvent.EVENT_NAME, mapOf("registrationName" to OnMentionEvent.EVENT_NAME))
|
|
72
|
+
map.put(OnChangeSelectionEvent.EVENT_NAME, mapOf("registrationName" to OnChangeSelectionEvent.EVENT_NAME))
|
|
73
|
+
map.put(OnRequestHtmlResultEvent.EVENT_NAME, mapOf("registrationName" to OnRequestHtmlResultEvent.EVENT_NAME))
|
|
74
|
+
map.put(OnInputKeyPressEvent.EVENT_NAME, mapOf("registrationName" to OnInputKeyPressEvent.EVENT_NAME))
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
return map
|
|
77
|
+
}
|
|
77
78
|
|
|
78
79
|
@ReactProp(name = "defaultValue")
|
|
79
|
-
override fun setDefaultValue(
|
|
80
|
+
override fun setDefaultValue(
|
|
81
|
+
view: EnrichedTextInputView?,
|
|
82
|
+
value: String?,
|
|
83
|
+
) {
|
|
80
84
|
view?.setDefaultValue(value)
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
@ReactProp(name = "placeholder")
|
|
84
|
-
override fun setPlaceholder(
|
|
88
|
+
override fun setPlaceholder(
|
|
89
|
+
view: EnrichedTextInputView?,
|
|
90
|
+
value: String?,
|
|
91
|
+
) {
|
|
85
92
|
view?.setPlaceholder(value)
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
@ReactProp(name = "placeholderTextColor", customType = "Color")
|
|
89
|
-
override fun setPlaceholderTextColor(
|
|
96
|
+
override fun setPlaceholderTextColor(
|
|
97
|
+
view: EnrichedTextInputView?,
|
|
98
|
+
color: Int?,
|
|
99
|
+
) {
|
|
90
100
|
view?.setPlaceholderTextColor(color)
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
@ReactProp(name = "cursorColor", customType = "Color")
|
|
94
|
-
override fun setCursorColor(
|
|
104
|
+
override fun setCursorColor(
|
|
105
|
+
view: EnrichedTextInputView?,
|
|
106
|
+
color: Int?,
|
|
107
|
+
) {
|
|
95
108
|
view?.setCursorColor(color)
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
@ReactProp(name = "selectionColor", customType = "Color")
|
|
99
|
-
override fun setSelectionColor(
|
|
112
|
+
override fun setSelectionColor(
|
|
113
|
+
view: EnrichedTextInputView?,
|
|
114
|
+
color: Int?,
|
|
115
|
+
) {
|
|
100
116
|
view?.setSelectionColor(color)
|
|
101
117
|
}
|
|
102
118
|
|
|
103
119
|
@ReactProp(name = "autoFocus", defaultBoolean = false)
|
|
104
|
-
override fun setAutoFocus(
|
|
120
|
+
override fun setAutoFocus(
|
|
121
|
+
view: EnrichedTextInputView?,
|
|
122
|
+
autoFocus: Boolean,
|
|
123
|
+
) {
|
|
105
124
|
view?.setAutoFocus(autoFocus)
|
|
106
125
|
}
|
|
107
126
|
|
|
108
127
|
@ReactProp(name = "editable", defaultBoolean = true)
|
|
109
|
-
override fun setEditable(
|
|
128
|
+
override fun setEditable(
|
|
129
|
+
view: EnrichedTextInputView?,
|
|
130
|
+
editable: Boolean,
|
|
131
|
+
) {
|
|
110
132
|
view?.isEnabled = editable
|
|
111
133
|
}
|
|
112
134
|
|
|
113
135
|
@ReactProp(name = "mentionIndicators")
|
|
114
|
-
override fun setMentionIndicators(
|
|
136
|
+
override fun setMentionIndicators(
|
|
137
|
+
view: EnrichedTextInputView?,
|
|
138
|
+
indicators: ReadableArray?,
|
|
139
|
+
) {
|
|
115
140
|
if (indicators == null) return
|
|
116
141
|
|
|
117
142
|
val indicatorsList = mutableListOf<String>()
|
|
@@ -125,37 +150,58 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
125
150
|
}
|
|
126
151
|
|
|
127
152
|
@ReactProp(name = "htmlStyle")
|
|
128
|
-
override fun setHtmlStyle(
|
|
153
|
+
override fun setHtmlStyle(
|
|
154
|
+
view: EnrichedTextInputView?,
|
|
155
|
+
style: ReadableMap?,
|
|
156
|
+
) {
|
|
129
157
|
view?.htmlStyle = HtmlStyle(view, style)
|
|
130
158
|
}
|
|
131
159
|
|
|
132
160
|
@ReactProp(name = ViewProps.COLOR, customType = "Color")
|
|
133
|
-
override fun setColor(
|
|
161
|
+
override fun setColor(
|
|
162
|
+
view: EnrichedTextInputView?,
|
|
163
|
+
color: Int?,
|
|
164
|
+
) {
|
|
134
165
|
view?.setColor(color)
|
|
135
166
|
}
|
|
136
167
|
|
|
137
168
|
@ReactProp(name = "fontSize", defaultFloat = ViewDefaults.FONT_SIZE_SP)
|
|
138
|
-
override fun setFontSize(
|
|
169
|
+
override fun setFontSize(
|
|
170
|
+
view: EnrichedTextInputView?,
|
|
171
|
+
size: Float,
|
|
172
|
+
) {
|
|
139
173
|
view?.setFontSize(size)
|
|
140
174
|
}
|
|
141
175
|
|
|
142
176
|
@ReactProp(name = "fontFamily")
|
|
143
|
-
override fun setFontFamily(
|
|
177
|
+
override fun setFontFamily(
|
|
178
|
+
view: EnrichedTextInputView?,
|
|
179
|
+
family: String?,
|
|
180
|
+
) {
|
|
144
181
|
view?.setFontFamily(family)
|
|
145
182
|
}
|
|
146
183
|
|
|
147
184
|
@ReactProp(name = "fontWeight")
|
|
148
|
-
override fun setFontWeight(
|
|
185
|
+
override fun setFontWeight(
|
|
186
|
+
view: EnrichedTextInputView?,
|
|
187
|
+
weight: String?,
|
|
188
|
+
) {
|
|
149
189
|
view?.setFontWeight(weight)
|
|
150
190
|
}
|
|
151
191
|
|
|
152
192
|
@ReactProp(name = "fontStyle")
|
|
153
|
-
override fun setFontStyle(
|
|
193
|
+
override fun setFontStyle(
|
|
194
|
+
view: EnrichedTextInputView?,
|
|
195
|
+
style: String?,
|
|
196
|
+
) {
|
|
154
197
|
view?.setFontStyle(style)
|
|
155
198
|
}
|
|
156
199
|
|
|
157
200
|
@ReactProp(name = "scrollEnabled")
|
|
158
|
-
override fun setScrollEnabled(
|
|
201
|
+
override fun setScrollEnabled(
|
|
202
|
+
view: EnrichedTextInputView,
|
|
203
|
+
scrollEnabled: Boolean,
|
|
204
|
+
) {
|
|
159
205
|
view.scrollEnabled = scrollEnabled
|
|
160
206
|
}
|
|
161
207
|
|
|
@@ -169,24 +215,44 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
169
215
|
left: Int,
|
|
170
216
|
top: Int,
|
|
171
217
|
right: Int,
|
|
172
|
-
bottom: Int
|
|
218
|
+
bottom: Int,
|
|
173
219
|
) {
|
|
174
220
|
super.setPadding(view, left, top, right, bottom)
|
|
175
221
|
|
|
176
222
|
view?.setPadding(left, top, right, bottom)
|
|
177
223
|
}
|
|
178
224
|
|
|
179
|
-
override fun setIsOnChangeHtmlSet(
|
|
225
|
+
override fun setIsOnChangeHtmlSet(
|
|
226
|
+
view: EnrichedTextInputView?,
|
|
227
|
+
value: Boolean,
|
|
228
|
+
) {
|
|
180
229
|
view?.shouldEmitHtml = value
|
|
181
230
|
}
|
|
182
231
|
|
|
183
|
-
override fun
|
|
232
|
+
override fun setIsOnChangeTextSet(
|
|
233
|
+
view: EnrichedTextInputView?,
|
|
234
|
+
value: Boolean,
|
|
235
|
+
) {
|
|
236
|
+
view?.shouldEmitOnChangeText = value
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
override fun setAutoCapitalize(
|
|
240
|
+
view: EnrichedTextInputView?,
|
|
241
|
+
flag: String?,
|
|
242
|
+
) {
|
|
184
243
|
view?.setAutoCapitalize(flag)
|
|
185
244
|
}
|
|
186
245
|
|
|
246
|
+
override fun setLinkRegex(
|
|
247
|
+
view: EnrichedTextInputView?,
|
|
248
|
+
config: ReadableMap?,
|
|
249
|
+
) {
|
|
250
|
+
view?.setLinkRegex(config)
|
|
251
|
+
}
|
|
252
|
+
|
|
187
253
|
override fun setAndroidExperimentalSynchronousEvents(
|
|
188
254
|
view: EnrichedTextInputView?,
|
|
189
|
-
value: Boolean
|
|
255
|
+
value: Boolean,
|
|
190
256
|
) {
|
|
191
257
|
view?.experimentalSynchronousEvents = value
|
|
192
258
|
}
|
|
@@ -199,10 +265,21 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
199
265
|
view?.clearFocus()
|
|
200
266
|
}
|
|
201
267
|
|
|
202
|
-
override fun setValue(
|
|
268
|
+
override fun setValue(
|
|
269
|
+
view: EnrichedTextInputView?,
|
|
270
|
+
text: String,
|
|
271
|
+
) {
|
|
203
272
|
view?.setValue(text)
|
|
204
273
|
}
|
|
205
274
|
|
|
275
|
+
override fun setSelection(
|
|
276
|
+
view: EnrichedTextInputView?,
|
|
277
|
+
start: Int,
|
|
278
|
+
end: Int,
|
|
279
|
+
) {
|
|
280
|
+
view?.setCustomSelection(start, end)
|
|
281
|
+
}
|
|
282
|
+
|
|
206
283
|
override fun toggleBold(view: EnrichedTextInputView?) {
|
|
207
284
|
view?.verifyAndToggleStyle(EnrichedSpans.BOLD)
|
|
208
285
|
}
|
|
@@ -235,6 +312,18 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
235
312
|
view?.verifyAndToggleStyle(EnrichedSpans.H3)
|
|
236
313
|
}
|
|
237
314
|
|
|
315
|
+
override fun toggleH4(view: EnrichedTextInputView?) {
|
|
316
|
+
view?.verifyAndToggleStyle(EnrichedSpans.H4)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
override fun toggleH5(view: EnrichedTextInputView?) {
|
|
320
|
+
view?.verifyAndToggleStyle(EnrichedSpans.H5)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
override fun toggleH6(view: EnrichedTextInputView?) {
|
|
324
|
+
view?.verifyAndToggleStyle(EnrichedSpans.H6)
|
|
325
|
+
}
|
|
326
|
+
|
|
238
327
|
override fun toggleCodeBlock(view: EnrichedTextInputView?) {
|
|
239
328
|
view?.verifyAndToggleStyle(EnrichedSpans.CODE_BLOCK)
|
|
240
329
|
}
|
|
@@ -251,23 +340,49 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
251
340
|
view?.verifyAndToggleStyle(EnrichedSpans.UNORDERED_LIST)
|
|
252
341
|
}
|
|
253
342
|
|
|
254
|
-
override fun addLink(
|
|
343
|
+
override fun addLink(
|
|
344
|
+
view: EnrichedTextInputView?,
|
|
345
|
+
start: Int,
|
|
346
|
+
end: Int,
|
|
347
|
+
text: String,
|
|
348
|
+
url: String,
|
|
349
|
+
) {
|
|
255
350
|
view?.addLink(start, end, text, url)
|
|
256
351
|
}
|
|
257
352
|
|
|
258
|
-
override fun addImage(
|
|
353
|
+
override fun addImage(
|
|
354
|
+
view: EnrichedTextInputView?,
|
|
355
|
+
src: String,
|
|
356
|
+
width: Float,
|
|
357
|
+
height: Float,
|
|
358
|
+
) {
|
|
259
359
|
view?.addImage(src, width, height)
|
|
260
360
|
}
|
|
261
361
|
|
|
262
|
-
override fun startMention(
|
|
362
|
+
override fun startMention(
|
|
363
|
+
view: EnrichedTextInputView?,
|
|
364
|
+
indicator: String,
|
|
365
|
+
) {
|
|
263
366
|
view?.startMention(indicator)
|
|
264
367
|
}
|
|
265
368
|
|
|
266
|
-
override fun addMention(
|
|
369
|
+
override fun addMention(
|
|
370
|
+
view: EnrichedTextInputView?,
|
|
371
|
+
indicator: String,
|
|
372
|
+
text: String,
|
|
373
|
+
payload: String,
|
|
374
|
+
) {
|
|
267
375
|
val attributes = jsonStringToStringMap(payload)
|
|
268
376
|
view?.addMention(text, indicator, attributes)
|
|
269
377
|
}
|
|
270
378
|
|
|
379
|
+
override fun requestHTML(
|
|
380
|
+
view: EnrichedTextInputView?,
|
|
381
|
+
requestId: Int,
|
|
382
|
+
) {
|
|
383
|
+
view?.requestHTML(requestId)
|
|
384
|
+
}
|
|
385
|
+
|
|
271
386
|
override fun measure(
|
|
272
387
|
context: Context,
|
|
273
388
|
localData: ReadableMap?,
|
|
@@ -277,10 +392,10 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
|
|
|
277
392
|
widthMode: YogaMeasureMode?,
|
|
278
393
|
height: Float,
|
|
279
394
|
heightMode: YogaMeasureMode?,
|
|
280
|
-
attachmentsPositions: FloatArray
|
|
395
|
+
attachmentsPositions: FloatArray?,
|
|
281
396
|
): Long {
|
|
282
397
|
val id = localData?.getInt("viewTag")
|
|
283
|
-
return MeasurementStore.getMeasureById(context, id, width, props)
|
|
398
|
+
return MeasurementStore.getMeasureById(context, id, width, height, heightMode, props)
|
|
284
399
|
}
|
|
285
400
|
|
|
286
401
|
companion object {
|
|
@@ -15,7 +15,5 @@ class EnrichedTextInputViewPackage : ReactPackage {
|
|
|
15
15
|
return viewManagers
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule>
|
|
19
|
-
return emptyList()
|
|
20
|
-
}
|
|
18
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> = emptyList()
|
|
21
19
|
}
|
|
@@ -13,6 +13,7 @@ import com.facebook.react.uimanager.PixelUtil
|
|
|
13
13
|
import com.facebook.react.views.text.ReactTypefaceUtils.applyStyles
|
|
14
14
|
import com.facebook.react.views.text.ReactTypefaceUtils.parseFontStyle
|
|
15
15
|
import com.facebook.react.views.text.ReactTypefaceUtils.parseFontWeight
|
|
16
|
+
import com.facebook.yoga.YogaMeasureMode
|
|
16
17
|
import com.facebook.yoga.YogaMeasureOutput
|
|
17
18
|
import com.swmansion.enriched.styles.HtmlStyle
|
|
18
19
|
import com.swmansion.enriched.utils.EnrichedParser
|
|
@@ -27,17 +28,19 @@ object MeasurementStore {
|
|
|
27
28
|
|
|
28
29
|
data class MeasurementParams(
|
|
29
30
|
val initialized: Boolean,
|
|
30
|
-
|
|
31
31
|
val cachedWidth: Float,
|
|
32
32
|
val cachedSize: Long,
|
|
33
|
-
|
|
34
33
|
val spannable: CharSequence?,
|
|
35
34
|
val paintParams: PaintParams,
|
|
36
35
|
)
|
|
37
36
|
|
|
38
37
|
private val data = ConcurrentHashMap<Int, MeasurementParams>()
|
|
39
38
|
|
|
40
|
-
fun store(
|
|
39
|
+
fun store(
|
|
40
|
+
id: Int,
|
|
41
|
+
spannable: Spannable?,
|
|
42
|
+
paint: TextPaint,
|
|
43
|
+
): Boolean {
|
|
41
44
|
val cachedWidth = data[id]?.cachedWidth ?: 0f
|
|
42
45
|
val cachedSize = data[id]?.cachedSize ?: 0L
|
|
43
46
|
val initialized = data[id]?.initialized ?: true
|
|
@@ -53,22 +56,32 @@ object MeasurementStore {
|
|
|
53
56
|
data.remove(id)
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
private fun measure(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
private fun measure(
|
|
60
|
+
maxWidth: Float,
|
|
61
|
+
spannable: CharSequence?,
|
|
62
|
+
paintParams: PaintParams,
|
|
63
|
+
): Long {
|
|
64
|
+
val paint =
|
|
65
|
+
TextPaint().apply {
|
|
66
|
+
typeface = paintParams.typeface
|
|
67
|
+
textSize = paintParams.fontSize
|
|
68
|
+
}
|
|
61
69
|
|
|
62
70
|
return measure(maxWidth, spannable, paint)
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
private fun measure(
|
|
73
|
+
private fun measure(
|
|
74
|
+
maxWidth: Float,
|
|
75
|
+
spannable: CharSequence?,
|
|
76
|
+
paint: TextPaint,
|
|
77
|
+
): Long {
|
|
66
78
|
val text = spannable ?: ""
|
|
67
79
|
val textLength = text.length
|
|
68
|
-
val builder =
|
|
69
|
-
.
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
val builder =
|
|
81
|
+
StaticLayout.Builder
|
|
82
|
+
.obtain(text, 0, textLength, paint, maxWidth.toInt())
|
|
83
|
+
.setIncludePad(true)
|
|
84
|
+
.setLineSpacing(0f, 1f)
|
|
72
85
|
|
|
73
86
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
74
87
|
builder.setBreakStrategy(LineBreaker.BREAK_STRATEGY_HIGH_QUALITY)
|
|
@@ -85,7 +98,10 @@ object MeasurementStore {
|
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
// Returns either: Spannable parsed from HTML defaultValue, or plain text defaultValue, or "I" if no defaultValue
|
|
88
|
-
private fun getInitialText(
|
|
101
|
+
private fun getInitialText(
|
|
102
|
+
defaultView: EnrichedTextInputView,
|
|
103
|
+
props: ReadableMap?,
|
|
104
|
+
): CharSequence {
|
|
89
105
|
val defaultValue = props?.getString("defaultValue")
|
|
90
106
|
|
|
91
107
|
// If there is no default value, assume text is one line, "I" is a good approximation of height
|
|
@@ -104,7 +120,10 @@ object MeasurementStore {
|
|
|
104
120
|
}
|
|
105
121
|
}
|
|
106
122
|
|
|
107
|
-
private fun getInitialFontSize(
|
|
123
|
+
private fun getInitialFontSize(
|
|
124
|
+
defaultView: EnrichedTextInputView,
|
|
125
|
+
props: ReadableMap?,
|
|
126
|
+
): Float {
|
|
108
127
|
val propsFontSize = props?.getDouble("fontSize")?.toFloat()
|
|
109
128
|
if (propsFontSize == null) return defaultView.textSize
|
|
110
129
|
|
|
@@ -113,7 +132,12 @@ object MeasurementStore {
|
|
|
113
132
|
|
|
114
133
|
// Called when view measurements are not available in the store
|
|
115
134
|
// Most likely first measurement, we can use defaultValue, as no native state is set yet
|
|
116
|
-
private fun initialMeasure(
|
|
135
|
+
private fun initialMeasure(
|
|
136
|
+
context: Context,
|
|
137
|
+
id: Int?,
|
|
138
|
+
width: Float,
|
|
139
|
+
props: ReadableMap?,
|
|
140
|
+
): Long {
|
|
117
141
|
val defaultView = EnrichedTextInputView(context)
|
|
118
142
|
|
|
119
143
|
val text = getInitialText(defaultView, props)
|
|
@@ -134,7 +158,12 @@ object MeasurementStore {
|
|
|
134
158
|
return size
|
|
135
159
|
}
|
|
136
160
|
|
|
137
|
-
fun getMeasureById(
|
|
161
|
+
private fun getMeasureById(
|
|
162
|
+
context: Context,
|
|
163
|
+
id: Int?,
|
|
164
|
+
width: Float,
|
|
165
|
+
props: ReadableMap?,
|
|
166
|
+
): Long {
|
|
138
167
|
val id = id ?: return initialMeasure(context, id, width, props)
|
|
139
168
|
val value = data[id] ?: return initialMeasure(context, id, width, props)
|
|
140
169
|
|
|
@@ -146,13 +175,33 @@ object MeasurementStore {
|
|
|
146
175
|
return value.cachedSize
|
|
147
176
|
}
|
|
148
177
|
|
|
149
|
-
val paint =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
178
|
+
val paint =
|
|
179
|
+
TextPaint().apply {
|
|
180
|
+
typeface = value.paintParams.typeface
|
|
181
|
+
textSize = value.paintParams.fontSize
|
|
182
|
+
}
|
|
153
183
|
|
|
154
184
|
val size = measure(width, value.spannable, paint)
|
|
155
185
|
data[id] = MeasurementParams(true, width, size, value.spannable, value.paintParams)
|
|
156
186
|
return size
|
|
157
187
|
}
|
|
188
|
+
|
|
189
|
+
fun getMeasureById(
|
|
190
|
+
context: Context,
|
|
191
|
+
id: Int?,
|
|
192
|
+
width: Float,
|
|
193
|
+
height: Float,
|
|
194
|
+
heightMode: YogaMeasureMode?,
|
|
195
|
+
props: ReadableMap?,
|
|
196
|
+
): Long {
|
|
197
|
+
val size = getMeasureById(context, id, width, props)
|
|
198
|
+
if (heightMode !== YogaMeasureMode.AT_MOST) {
|
|
199
|
+
return size
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
val calculatedHeight = YogaMeasureOutput.getHeight(size)
|
|
203
|
+
val atMostHeight = PixelUtil.toDIPFromPixel(height)
|
|
204
|
+
val finalHeight = calculatedHeight.coerceAtMost(atMostHeight)
|
|
205
|
+
return YogaMeasureOutput.make(YogaMeasureOutput.getWidth(size), finalHeight)
|
|
206
|
+
}
|
|
158
207
|
}
|
|
@@ -4,13 +4,15 @@ import com.facebook.react.bridge.ReactContext
|
|
|
4
4
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
5
5
|
import com.swmansion.enriched.EnrichedTextInputView
|
|
6
6
|
|
|
7
|
-
class MentionHandler(
|
|
7
|
+
class MentionHandler(
|
|
8
|
+
private val view: EnrichedTextInputView,
|
|
9
|
+
) {
|
|
8
10
|
private var previousText: String? = null
|
|
9
11
|
private var previousIndicator: String? = null
|
|
10
12
|
|
|
11
13
|
fun reset() {
|
|
14
|
+
endMention()
|
|
12
15
|
previousText = null
|
|
13
|
-
previousIndicator = null
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
fun endMention() {
|
|
@@ -21,12 +23,18 @@ class MentionHandler(private val view: EnrichedTextInputView) {
|
|
|
21
23
|
previousIndicator = null
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
fun onMention(
|
|
26
|
+
fun onMention(
|
|
27
|
+
indicator: String,
|
|
28
|
+
text: String?,
|
|
29
|
+
) {
|
|
25
30
|
emitEvent(indicator, text)
|
|
26
31
|
previousIndicator = indicator
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
private fun emitEvent(
|
|
34
|
+
private fun emitEvent(
|
|
35
|
+
indicator: String,
|
|
36
|
+
text: String?,
|
|
37
|
+
) {
|
|
30
38
|
// Do not emit events too often
|
|
31
39
|
if (previousText == text) return
|
|
32
40
|
|
|
@@ -34,12 +42,14 @@ class MentionHandler(private val view: EnrichedTextInputView) {
|
|
|
34
42
|
val context = view.context as ReactContext
|
|
35
43
|
val surfaceId = UIManagerHelper.getSurfaceId(context)
|
|
36
44
|
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, view.id)
|
|
37
|
-
dispatcher?.dispatchEvent(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
dispatcher?.dispatchEvent(
|
|
46
|
+
OnMentionEvent(
|
|
47
|
+
surfaceId,
|
|
48
|
+
view.id,
|
|
49
|
+
indicator,
|
|
50
|
+
text,
|
|
51
|
+
view.experimentalSynchronousEvents,
|
|
52
|
+
),
|
|
53
|
+
)
|
|
44
54
|
}
|
|
45
55
|
}
|
|
@@ -4,12 +4,13 @@ import com.facebook.react.bridge.Arguments
|
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
5
|
import com.facebook.react.uimanager.events.Event
|
|
6
6
|
|
|
7
|
-
class OnChangeHtmlEvent(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
class OnChangeHtmlEvent(
|
|
8
|
+
surfaceId: Int,
|
|
9
|
+
viewId: Int,
|
|
10
|
+
private val html: String,
|
|
11
|
+
private val experimentalSynchronousEvents: Boolean,
|
|
12
|
+
) : Event<OnChangeHtmlEvent>(surfaceId, viewId) {
|
|
13
|
+
override fun getEventName(): String = EVENT_NAME
|
|
13
14
|
|
|
14
15
|
override fun getEventData(): WritableMap {
|
|
15
16
|
val eventData: WritableMap = Arguments.createMap()
|
|
@@ -18,9 +19,7 @@ class OnChangeHtmlEvent(surfaceId: Int, viewId: Int, private val html: String, p
|
|
|
18
19
|
return eventData
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
override fun experimental_isSynchronous(): Boolean
|
|
22
|
-
return experimentalSynchronousEvents
|
|
23
|
-
}
|
|
22
|
+
override fun experimental_isSynchronous(): Boolean = experimentalSynchronousEvents
|
|
24
23
|
|
|
25
24
|
companion object {
|
|
26
25
|
const val EVENT_NAME: String = "onChangeHtml"
|
|
@@ -4,12 +4,15 @@ import com.facebook.react.bridge.Arguments
|
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
5
|
import com.facebook.react.uimanager.events.Event
|
|
6
6
|
|
|
7
|
-
class OnChangeSelectionEvent(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
class OnChangeSelectionEvent(
|
|
8
|
+
surfaceId: Int,
|
|
9
|
+
viewId: Int,
|
|
10
|
+
private val text: String,
|
|
11
|
+
private val start: Int,
|
|
12
|
+
private val end: Int,
|
|
13
|
+
private val experimentalSynchronousEvents: Boolean,
|
|
14
|
+
) : Event<OnChangeSelectionEvent>(surfaceId, viewId) {
|
|
15
|
+
override fun getEventName(): String = EVENT_NAME
|
|
13
16
|
|
|
14
17
|
override fun getEventData(): WritableMap {
|
|
15
18
|
val eventData: WritableMap = Arguments.createMap()
|
|
@@ -19,9 +22,7 @@ class OnChangeSelectionEvent(surfaceId: Int, viewId: Int, private val text: Stri
|
|
|
19
22
|
return eventData
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
override fun experimental_isSynchronous(): Boolean
|
|
23
|
-
return experimentalSynchronousEvents
|
|
24
|
-
}
|
|
25
|
+
override fun experimental_isSynchronous(): Boolean = experimentalSynchronousEvents
|
|
25
26
|
|
|
26
27
|
companion object {
|
|
27
28
|
const val EVENT_NAME: String = "onChangeSelection"
|