react-native-enriched 0.0.0 → 0.1.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/LICENSE +20 -0
- package/README.md +869 -0
- package/ReactNativeEnriched.podspec +27 -0
- package/android/build.gradle +101 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +146 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +55 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.cpp +118 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h +95 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.cpp +128 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.h +577 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ShadowNodes.h +23 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/States.h +20 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +535 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewLayoutManager.kt +64 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt +292 -0
- package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewPackage.kt +19 -0
- package/android/src/main/java/com/swmansion/enriched/events/MentionHandler.kt +40 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeHtmlEvent.kt +28 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeSelectionEvent.kt +29 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnChangeTextEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnInputBlurEvent.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnInputFocusEvent.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnLinkDetectedEvent.kt +30 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnMentionDetectedEvent.kt +29 -0
- package/android/src/main/java/com/swmansion/enriched/events/OnMentionEvent.kt +33 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBlockQuoteSpan.kt +34 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBoldSpan.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedCodeBlockSpan.kt +38 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH1Span.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH2Span.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH3Span.kt +17 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedImageSpan.kt +41 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedInlineCodeSpan.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedItalicSpan.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedLinkSpan.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedMentionSpan.kt +36 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedOrderedListSpan.kt +71 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedSpans.kt +111 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedStrikeThroughSpan.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnderlineSpan.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnorderedListSpan.kt +49 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedBlockSpan.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedHeadingSpan.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedInlineSpan.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedParagraphSpan.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedSpan.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +5 -0
- package/android/src/main/java/com/swmansion/enriched/styles/HtmlStyle.kt +227 -0
- package/android/src/main/java/com/swmansion/enriched/styles/InlineStyles.kt +146 -0
- package/android/src/main/java/com/swmansion/enriched/styles/ListStyles.kt +173 -0
- package/android/src/main/java/com/swmansion/enriched/styles/ParagraphStyles.kt +186 -0
- package/android/src/main/java/com/swmansion/enriched/styles/ParametrizedStyles.kt +223 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedParser.java +857 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSelection.kt +285 -0
- package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpanState.kt +204 -0
- package/android/src/main/java/com/swmansion/enriched/utils/Utils.kt +91 -0
- package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedSpanWatcher.kt +73 -0
- package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedTextWatcher.kt +51 -0
- package/android/src/main/new_arch/CMakeLists.txt +56 -0
- package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.cpp +22 -0
- package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.h +26 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputComponentDescriptor.h +35 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.cpp +51 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.h +26 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.cpp +34 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.h +54 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.cpp +9 -0
- package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.h +25 -0
- package/ios/EnrichedTextInputView.h +33 -0
- package/ios/EnrichedTextInputView.mm +1190 -0
- package/ios/EnrichedTextInputViewManager.mm +13 -0
- package/ios/config/InputConfig.h +67 -0
- package/ios/config/InputConfig.mm +382 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.cpp +118 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.h +95 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/Props.cpp +128 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/Props.h +577 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/RCTComponentViewHelpers.h +384 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/ShadowNodes.h +23 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/States.cpp +16 -0
- package/ios/generated/RNEnrichedTextInputViewSpec/States.h +20 -0
- package/ios/inputParser/InputParser.h +11 -0
- package/ios/inputParser/InputParser.mm +669 -0
- package/ios/inputTextView/InputTextView.h +6 -0
- package/ios/inputTextView/InputTextView.mm +115 -0
- package/ios/internals/EnrichedTextInputViewComponentDescriptor.h +17 -0
- package/ios/internals/EnrichedTextInputViewShadowNode.h +40 -0
- package/ios/internals/EnrichedTextInputViewShadowNode.mm +83 -0
- package/ios/internals/EnrichedTextInputViewState.cpp +10 -0
- package/ios/internals/EnrichedTextInputViewState.h +20 -0
- package/ios/styles/BlockQuoteStyle.mm +248 -0
- package/ios/styles/BoldStyle.mm +122 -0
- package/ios/styles/H1Style.mm +10 -0
- package/ios/styles/H2Style.mm +10 -0
- package/ios/styles/H3Style.mm +10 -0
- package/ios/styles/HeadingStyleBase.mm +144 -0
- package/ios/styles/InlineCodeStyle.mm +163 -0
- package/ios/styles/ItalicStyle.mm +110 -0
- package/ios/styles/LinkStyle.mm +463 -0
- package/ios/styles/MentionStyle.mm +476 -0
- package/ios/styles/OrderedListStyle.mm +225 -0
- package/ios/styles/StrikethroughStyle.mm +80 -0
- package/ios/styles/UnderlineStyle.mm +112 -0
- package/ios/styles/UnorderedListStyle.mm +225 -0
- package/ios/utils/BaseStyleProtocol.h +16 -0
- package/ios/utils/ColorExtension.h +6 -0
- package/ios/utils/ColorExtension.mm +27 -0
- package/ios/utils/FontExtension.h +13 -0
- package/ios/utils/FontExtension.mm +91 -0
- package/ios/utils/LayoutManagerExtension.h +6 -0
- package/ios/utils/LayoutManagerExtension.mm +171 -0
- package/ios/utils/LinkData.h +9 -0
- package/ios/utils/LinkData.mm +4 -0
- package/ios/utils/MentionParams.h +9 -0
- package/ios/utils/MentionParams.mm +4 -0
- package/ios/utils/MentionStyleProps.h +13 -0
- package/ios/utils/MentionStyleProps.mm +56 -0
- package/ios/utils/OccurenceUtils.h +37 -0
- package/ios/utils/OccurenceUtils.mm +124 -0
- package/ios/utils/ParagraphsUtils.h +7 -0
- package/ios/utils/ParagraphsUtils.mm +54 -0
- package/ios/utils/StringExtension.h +15 -0
- package/ios/utils/StringExtension.mm +57 -0
- package/ios/utils/StyleHeaders.h +74 -0
- package/ios/utils/StylePair.h +9 -0
- package/ios/utils/StylePair.mm +4 -0
- package/ios/utils/StyleTypeEnum.h +22 -0
- package/ios/utils/TextDecorationLineEnum.h +6 -0
- package/ios/utils/TextDecorationLineEnum.mm +4 -0
- package/ios/utils/TextInsertionUtils.h +6 -0
- package/ios/utils/TextInsertionUtils.mm +48 -0
- package/ios/utils/WordsUtils.h +6 -0
- package/ios/utils/WordsUtils.mm +88 -0
- package/ios/utils/ZeroWidthSpaceUtils.h +7 -0
- package/ios/utils/ZeroWidthSpaceUtils.mm +164 -0
- package/lib/module/EnrichedTextInput.js +191 -0
- package/lib/module/EnrichedTextInput.js.map +1 -0
- package/lib/module/EnrichedTextInputNativeComponent.ts +235 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/normalizeHtmlStyle.js +141 -0
- package/lib/module/normalizeHtmlStyle.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/EnrichedTextInput.d.ts +113 -0
- package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -0
- package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts +160 -0
- package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/normalizeHtmlStyle.d.ts +4 -0
- package/lib/typescript/src/normalizeHtmlStyle.d.ts.map +1 -0
- package/package.json +172 -1
- package/react-native.config.js +13 -0
- package/src/EnrichedTextInput.tsx +358 -0
- package/src/EnrichedTextInputNativeComponent.ts +235 -0
- package/src/index.tsx +9 -0
- package/src/normalizeHtmlStyle.ts +188 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "ReactNativeEnriched"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/software-mansion-labs/react-native-rich-text-editor.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
21
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
22
|
+
install_modules_dependencies(s)
|
|
23
|
+
else
|
|
24
|
+
s.dependency "React-Core"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['EnrichedTextInput_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
apply plugin: "com.android.library"
|
|
20
|
+
apply plugin: "kotlin-android"
|
|
21
|
+
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
23
|
+
|
|
24
|
+
def getExtOrIntegerDefault(name) {
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["EnrichedTextInput_" + name]).toInteger()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def supportsNamespace() {
|
|
29
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
30
|
+
def major = parsed[0].toInteger()
|
|
31
|
+
def minor = parsed[1].toInteger()
|
|
32
|
+
|
|
33
|
+
// Namespace support was added in 7.3.0
|
|
34
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
android {
|
|
38
|
+
if (supportsNamespace()) {
|
|
39
|
+
namespace "com.swmansion.enriched"
|
|
40
|
+
|
|
41
|
+
sourceSets {
|
|
42
|
+
main {
|
|
43
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
49
|
+
|
|
50
|
+
defaultConfig {
|
|
51
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
52
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
buildFeatures {
|
|
56
|
+
buildConfig true
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
buildTypes {
|
|
60
|
+
release {
|
|
61
|
+
minifyEnabled false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
lintOptions {
|
|
66
|
+
disable "GradleCompatible"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
compileOptions {
|
|
70
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
71
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
sourceSets {
|
|
75
|
+
main {
|
|
76
|
+
java.srcDirs += [
|
|
77
|
+
"generated/java",
|
|
78
|
+
"generated/jni"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
repositories {
|
|
85
|
+
mavenCentral()
|
|
86
|
+
google()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
90
|
+
|
|
91
|
+
dependencies {
|
|
92
|
+
implementation "com.facebook.react:react-android"
|
|
93
|
+
implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
|
|
94
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
react {
|
|
98
|
+
jsRootDir = file("../src/")
|
|
99
|
+
libraryName = "EnrichedTextInputView"
|
|
100
|
+
codegenJavaPackageName = "com.swmansion.enriched"
|
|
101
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ColorPropConverter;
|
|
15
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
16
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
17
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
18
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
19
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
20
|
+
|
|
21
|
+
public class EnrichedTextInputViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & EnrichedTextInputViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
22
|
+
public EnrichedTextInputViewManagerDelegate(U viewManager) {
|
|
23
|
+
super(viewManager);
|
|
24
|
+
}
|
|
25
|
+
@Override
|
|
26
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
27
|
+
switch (propName) {
|
|
28
|
+
case "autoFocus":
|
|
29
|
+
mViewManager.setAutoFocus(view, value == null ? false : (boolean) value);
|
|
30
|
+
break;
|
|
31
|
+
case "editable":
|
|
32
|
+
mViewManager.setEditable(view, value == null ? false : (boolean) value);
|
|
33
|
+
break;
|
|
34
|
+
case "defaultValue":
|
|
35
|
+
mViewManager.setDefaultValue(view, value == null ? null : (String) value);
|
|
36
|
+
break;
|
|
37
|
+
case "placeholder":
|
|
38
|
+
mViewManager.setPlaceholder(view, value == null ? null : (String) value);
|
|
39
|
+
break;
|
|
40
|
+
case "placeholderTextColor":
|
|
41
|
+
mViewManager.setPlaceholderTextColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
42
|
+
break;
|
|
43
|
+
case "mentionIndicators":
|
|
44
|
+
mViewManager.setMentionIndicators(view, (ReadableArray) value);
|
|
45
|
+
break;
|
|
46
|
+
case "cursorColor":
|
|
47
|
+
mViewManager.setCursorColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
48
|
+
break;
|
|
49
|
+
case "selectionColor":
|
|
50
|
+
mViewManager.setSelectionColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
51
|
+
break;
|
|
52
|
+
case "autoCapitalize":
|
|
53
|
+
mViewManager.setAutoCapitalize(view, value == null ? null : (String) value);
|
|
54
|
+
break;
|
|
55
|
+
case "htmlStyle":
|
|
56
|
+
mViewManager.setHtmlStyle(view, (ReadableMap) value);
|
|
57
|
+
break;
|
|
58
|
+
case "color":
|
|
59
|
+
mViewManager.setColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
60
|
+
break;
|
|
61
|
+
case "fontSize":
|
|
62
|
+
mViewManager.setFontSize(view, value == null ? 0f : ((Double) value).floatValue());
|
|
63
|
+
break;
|
|
64
|
+
case "fontFamily":
|
|
65
|
+
mViewManager.setFontFamily(view, value == null ? null : (String) value);
|
|
66
|
+
break;
|
|
67
|
+
case "fontWeight":
|
|
68
|
+
mViewManager.setFontWeight(view, value == null ? null : (String) value);
|
|
69
|
+
break;
|
|
70
|
+
case "fontStyle":
|
|
71
|
+
mViewManager.setFontStyle(view, value == null ? null : (String) value);
|
|
72
|
+
break;
|
|
73
|
+
case "isOnChangeHtmlSet":
|
|
74
|
+
mViewManager.setIsOnChangeHtmlSet(view, value == null ? false : (boolean) value);
|
|
75
|
+
break;
|
|
76
|
+
case "androidExperimentalSynchronousEvents":
|
|
77
|
+
mViewManager.setAndroidExperimentalSynchronousEvents(view, value == null ? false : (boolean) value);
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
super.setProperty(view, propName, value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Override
|
|
85
|
+
public void receiveCommand(T view, String commandName, ReadableArray args) {
|
|
86
|
+
switch (commandName) {
|
|
87
|
+
case "focus":
|
|
88
|
+
mViewManager.focus(view);
|
|
89
|
+
break;
|
|
90
|
+
case "blur":
|
|
91
|
+
mViewManager.blur(view);
|
|
92
|
+
break;
|
|
93
|
+
case "setValue":
|
|
94
|
+
mViewManager.setValue(view, args.getString(0));
|
|
95
|
+
break;
|
|
96
|
+
case "toggleBold":
|
|
97
|
+
mViewManager.toggleBold(view);
|
|
98
|
+
break;
|
|
99
|
+
case "toggleItalic":
|
|
100
|
+
mViewManager.toggleItalic(view);
|
|
101
|
+
break;
|
|
102
|
+
case "toggleUnderline":
|
|
103
|
+
mViewManager.toggleUnderline(view);
|
|
104
|
+
break;
|
|
105
|
+
case "toggleStrikeThrough":
|
|
106
|
+
mViewManager.toggleStrikeThrough(view);
|
|
107
|
+
break;
|
|
108
|
+
case "toggleInlineCode":
|
|
109
|
+
mViewManager.toggleInlineCode(view);
|
|
110
|
+
break;
|
|
111
|
+
case "toggleH1":
|
|
112
|
+
mViewManager.toggleH1(view);
|
|
113
|
+
break;
|
|
114
|
+
case "toggleH2":
|
|
115
|
+
mViewManager.toggleH2(view);
|
|
116
|
+
break;
|
|
117
|
+
case "toggleH3":
|
|
118
|
+
mViewManager.toggleH3(view);
|
|
119
|
+
break;
|
|
120
|
+
case "toggleCodeBlock":
|
|
121
|
+
mViewManager.toggleCodeBlock(view);
|
|
122
|
+
break;
|
|
123
|
+
case "toggleBlockQuote":
|
|
124
|
+
mViewManager.toggleBlockQuote(view);
|
|
125
|
+
break;
|
|
126
|
+
case "toggleOrderedList":
|
|
127
|
+
mViewManager.toggleOrderedList(view);
|
|
128
|
+
break;
|
|
129
|
+
case "toggleUnorderedList":
|
|
130
|
+
mViewManager.toggleUnorderedList(view);
|
|
131
|
+
break;
|
|
132
|
+
case "addLink":
|
|
133
|
+
mViewManager.addLink(view, args.getInt(0), args.getInt(1), args.getString(2), args.getString(3));
|
|
134
|
+
break;
|
|
135
|
+
case "addImage":
|
|
136
|
+
mViewManager.addImage(view, args.getString(0));
|
|
137
|
+
break;
|
|
138
|
+
case "startMention":
|
|
139
|
+
mViewManager.startMention(view, args.getString(0));
|
|
140
|
+
break;
|
|
141
|
+
case "addMention":
|
|
142
|
+
mViewManager.addMention(view, args.getString(0), args.getString(1), args.getString(2));
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
15
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
16
|
+
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
17
|
+
|
|
18
|
+
public interface EnrichedTextInputViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
19
|
+
void setAutoFocus(T view, boolean value);
|
|
20
|
+
void setEditable(T view, boolean value);
|
|
21
|
+
void setDefaultValue(T view, @Nullable String value);
|
|
22
|
+
void setPlaceholder(T view, @Nullable String value);
|
|
23
|
+
void setPlaceholderTextColor(T view, @Nullable Integer value);
|
|
24
|
+
void setMentionIndicators(T view, @Nullable ReadableArray value);
|
|
25
|
+
void setCursorColor(T view, @Nullable Integer value);
|
|
26
|
+
void setSelectionColor(T view, @Nullable Integer value);
|
|
27
|
+
void setAutoCapitalize(T view, @Nullable String value);
|
|
28
|
+
void setHtmlStyle(T view, @Nullable ReadableMap value);
|
|
29
|
+
void setColor(T view, @Nullable Integer value);
|
|
30
|
+
void setFontSize(T view, float value);
|
|
31
|
+
void setFontFamily(T view, @Nullable String value);
|
|
32
|
+
void setFontWeight(T view, @Nullable String value);
|
|
33
|
+
void setFontStyle(T view, @Nullable String value);
|
|
34
|
+
void setIsOnChangeHtmlSet(T view, boolean value);
|
|
35
|
+
void setAndroidExperimentalSynchronousEvents(T view, boolean value);
|
|
36
|
+
void focus(T view);
|
|
37
|
+
void blur(T view);
|
|
38
|
+
void setValue(T view, String text);
|
|
39
|
+
void toggleBold(T view);
|
|
40
|
+
void toggleItalic(T view);
|
|
41
|
+
void toggleUnderline(T view);
|
|
42
|
+
void toggleStrikeThrough(T view);
|
|
43
|
+
void toggleInlineCode(T view);
|
|
44
|
+
void toggleH1(T view);
|
|
45
|
+
void toggleH2(T view);
|
|
46
|
+
void toggleH3(T view);
|
|
47
|
+
void toggleCodeBlock(T view);
|
|
48
|
+
void toggleBlockQuote(T view);
|
|
49
|
+
void toggleOrderedList(T view);
|
|
50
|
+
void toggleUnorderedList(T view);
|
|
51
|
+
void addLink(T view, int start, int end, String text, String url);
|
|
52
|
+
void addImage(T view, String uri);
|
|
53
|
+
void startMention(T view, String indicator);
|
|
54
|
+
void addMention(T view, String indicator, String text, String payload);
|
|
55
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ComponentDescriptors.h"
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void RNEnrichedTextInputViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
void RNEnrichedTextInputViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
#include <jsi/JSIDynamic.h>
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void EnrichedTextInputViewEventEmitter::onInputFocus(OnInputFocus event) const {
|
|
17
|
+
dispatchEvent("inputFocus", [](jsi::Runtime &runtime) {
|
|
18
|
+
auto payload = jsi::Object(runtime);
|
|
19
|
+
|
|
20
|
+
return payload;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
void EnrichedTextInputViewEventEmitter::onInputBlur(OnInputBlur event) const {
|
|
26
|
+
dispatchEvent("inputBlur", [](jsi::Runtime &runtime) {
|
|
27
|
+
auto payload = jsi::Object(runtime);
|
|
28
|
+
|
|
29
|
+
return payload;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
void EnrichedTextInputViewEventEmitter::onChangeText(OnChangeText event) const {
|
|
35
|
+
dispatchEvent("changeText", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
36
|
+
auto payload = jsi::Object(runtime);
|
|
37
|
+
payload.setProperty(runtime, "value", event.value);
|
|
38
|
+
return payload;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
void EnrichedTextInputViewEventEmitter::onChangeHtml(OnChangeHtml event) const {
|
|
44
|
+
dispatchEvent("changeHtml", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
45
|
+
auto payload = jsi::Object(runtime);
|
|
46
|
+
payload.setProperty(runtime, "value", event.value);
|
|
47
|
+
return payload;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
void EnrichedTextInputViewEventEmitter::onChangeState(OnChangeState event) const {
|
|
53
|
+
dispatchEvent("changeState", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
54
|
+
auto payload = jsi::Object(runtime);
|
|
55
|
+
payload.setProperty(runtime, "isBold", event.isBold);
|
|
56
|
+
payload.setProperty(runtime, "isItalic", event.isItalic);
|
|
57
|
+
payload.setProperty(runtime, "isUnderline", event.isUnderline);
|
|
58
|
+
payload.setProperty(runtime, "isStrikeThrough", event.isStrikeThrough);
|
|
59
|
+
payload.setProperty(runtime, "isInlineCode", event.isInlineCode);
|
|
60
|
+
payload.setProperty(runtime, "isH1", event.isH1);
|
|
61
|
+
payload.setProperty(runtime, "isH2", event.isH2);
|
|
62
|
+
payload.setProperty(runtime, "isH3", event.isH3);
|
|
63
|
+
payload.setProperty(runtime, "isCodeBlock", event.isCodeBlock);
|
|
64
|
+
payload.setProperty(runtime, "isBlockQuote", event.isBlockQuote);
|
|
65
|
+
payload.setProperty(runtime, "isOrderedList", event.isOrderedList);
|
|
66
|
+
payload.setProperty(runtime, "isUnorderedList", event.isUnorderedList);
|
|
67
|
+
payload.setProperty(runtime, "isLink", event.isLink);
|
|
68
|
+
payload.setProperty(runtime, "isImage", event.isImage);
|
|
69
|
+
payload.setProperty(runtime, "isMention", event.isMention);
|
|
70
|
+
return payload;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
void EnrichedTextInputViewEventEmitter::onLinkDetected(OnLinkDetected event) const {
|
|
76
|
+
dispatchEvent("linkDetected", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
77
|
+
auto payload = jsi::Object(runtime);
|
|
78
|
+
payload.setProperty(runtime, "text", event.text);
|
|
79
|
+
payload.setProperty(runtime, "url", event.url);
|
|
80
|
+
payload.setProperty(runtime, "start", event.start);
|
|
81
|
+
payload.setProperty(runtime, "end", event.end);
|
|
82
|
+
return payload;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
void EnrichedTextInputViewEventEmitter::onMentionDetected(OnMentionDetected event) const {
|
|
88
|
+
dispatchEvent("mentionDetected", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
89
|
+
auto payload = jsi::Object(runtime);
|
|
90
|
+
payload.setProperty(runtime, "text", event.text);
|
|
91
|
+
payload.setProperty(runtime, "indicator", event.indicator);
|
|
92
|
+
payload.setProperty(runtime, "payload", event.payload);
|
|
93
|
+
return payload;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
void EnrichedTextInputViewEventEmitter::onMention(OnMention event) const {
|
|
99
|
+
dispatchEvent("mention", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
100
|
+
auto payload = jsi::Object(runtime);
|
|
101
|
+
payload.setProperty(runtime, "indicator", event.indicator);
|
|
102
|
+
payload.setProperty(runtime, "text", jsi::valueFromDynamic(runtime, event.text));
|
|
103
|
+
return payload;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
void EnrichedTextInputViewEventEmitter::onChangeSelection(OnChangeSelection event) const {
|
|
109
|
+
dispatchEvent("changeSelection", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
110
|
+
auto payload = jsi::Object(runtime);
|
|
111
|
+
payload.setProperty(runtime, "start", event.start);
|
|
112
|
+
payload.setProperty(runtime, "end", event.end);
|
|
113
|
+
payload.setProperty(runtime, "text", event.text);
|
|
114
|
+
return payload;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
#include <folly/dynamic.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class EnrichedTextInputViewEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnInputFocus {
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct OnInputBlur {
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
struct OnChangeText {
|
|
29
|
+
std::string value;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
struct OnChangeHtml {
|
|
33
|
+
std::string value;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
struct OnChangeState {
|
|
37
|
+
bool isBold;
|
|
38
|
+
bool isItalic;
|
|
39
|
+
bool isUnderline;
|
|
40
|
+
bool isStrikeThrough;
|
|
41
|
+
bool isInlineCode;
|
|
42
|
+
bool isH1;
|
|
43
|
+
bool isH2;
|
|
44
|
+
bool isH3;
|
|
45
|
+
bool isCodeBlock;
|
|
46
|
+
bool isBlockQuote;
|
|
47
|
+
bool isOrderedList;
|
|
48
|
+
bool isUnorderedList;
|
|
49
|
+
bool isLink;
|
|
50
|
+
bool isImage;
|
|
51
|
+
bool isMention;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
struct OnLinkDetected {
|
|
55
|
+
std::string text;
|
|
56
|
+
std::string url;
|
|
57
|
+
int start;
|
|
58
|
+
int end;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
struct OnMentionDetected {
|
|
62
|
+
std::string text;
|
|
63
|
+
std::string indicator;
|
|
64
|
+
std::string payload;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
struct OnMention {
|
|
68
|
+
std::string indicator;
|
|
69
|
+
folly::dynamic text;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
struct OnChangeSelection {
|
|
73
|
+
int start;
|
|
74
|
+
int end;
|
|
75
|
+
std::string text;
|
|
76
|
+
};
|
|
77
|
+
void onInputFocus(OnInputFocus value) const;
|
|
78
|
+
|
|
79
|
+
void onInputBlur(OnInputBlur value) const;
|
|
80
|
+
|
|
81
|
+
void onChangeText(OnChangeText value) const;
|
|
82
|
+
|
|
83
|
+
void onChangeHtml(OnChangeHtml value) const;
|
|
84
|
+
|
|
85
|
+
void onChangeState(OnChangeState value) const;
|
|
86
|
+
|
|
87
|
+
void onLinkDetected(OnLinkDetected value) const;
|
|
88
|
+
|
|
89
|
+
void onMentionDetected(OnMentionDetected value) const;
|
|
90
|
+
|
|
91
|
+
void onMention(OnMention value) const;
|
|
92
|
+
|
|
93
|
+
void onChangeSelection(OnChangeSelection value) const;
|
|
94
|
+
};
|
|
95
|
+
} // namespace facebook::react
|