@tbvjaos510/react-native-paste-input 0.9.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.
Files changed (108) hide show
  1. package/.circleci/config.yml +130 -0
  2. package/LICENSE +21 -0
  3. package/README.md +73 -0
  4. package/android/.project +17 -0
  5. package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
  6. package/android/build.gradle +94 -0
  7. package/android/generated/java/com/facebook/react/viewmanagers/PasteTextInputManagerDelegate.java +236 -0
  8. package/android/generated/java/com/facebook/react/viewmanagers/PasteTextInputManagerInterface.java +84 -0
  9. package/android/generated/jni/CMakeLists.txt +36 -0
  10. package/android/generated/jni/PasteTextInputSpecs-generated.cpp +27 -0
  11. package/android/generated/jni/PasteTextInputSpecs.h +28 -0
  12. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.cpp +22 -0
  13. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.h +166 -0
  14. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/EventEmitters.cpp +183 -0
  15. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/EventEmitters.h +148 -0
  16. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/PasteTextInputSpecsJSI-generated.cpp +17 -0
  17. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/PasteTextInputSpecsJSI.h +19 -0
  18. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/Props.cpp +640 -0
  19. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/Props.h +144 -0
  20. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ShadowNodes.cpp +247 -0
  21. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ShadowNodes.h +95 -0
  22. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/States.cpp +14 -0
  23. package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/States.h +19 -0
  24. package/android/gradle.properties +6 -0
  25. package/android/src/main/java/com/mattermost/pasteinputtext/IPasteInputListener.kt +8 -0
  26. package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputActionCallback.kt +72 -0
  27. package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputEditText.kt +60 -0
  28. package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputFileFromUrl.kt +50 -0
  29. package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputListener.kt +84 -0
  30. package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt +72 -0
  31. package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputPackage.kt +14 -0
  32. package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputPasteEvent.java +41 -0
  33. package/android/src/main/java/com/mattermost/pasteinputtext/RealPathUtil.kt +174 -0
  34. package/ios/NSData+MimeType.h +20 -0
  35. package/ios/NSData+MimeType.m +59 -0
  36. package/ios/PasteInput-Bridging-Header.h +1 -0
  37. package/ios/PasteInput.xcodeproj/project.pbxproj +319 -0
  38. package/ios/PasteInputTextView.h +20 -0
  39. package/ios/PasteInputTextView.m +68 -0
  40. package/ios/PasteInputView.h +18 -0
  41. package/ios/PasteInputView.m +96 -0
  42. package/ios/PasteTextInput.h +13 -0
  43. package/ios/PasteTextInput.mm +726 -0
  44. package/ios/PasteTextInputManager.mm +171 -0
  45. package/ios/Swime/MimeType.h +70 -0
  46. package/ios/Swime/MimeType.m +701 -0
  47. package/ios/Swime/Swime.h +14 -0
  48. package/ios/Swime/Swime.m +28 -0
  49. package/ios/Swime/SwimeProxy.h +18 -0
  50. package/ios/Swime/SwimeProxy.m +66 -0
  51. package/ios/Swime/SwimeUtils.h +12 -0
  52. package/ios/Swime/SwimeUtils.m +23 -0
  53. package/ios/UIImage+ImageEffects.h +112 -0
  54. package/ios/UIImage+ImageEffects.m +310 -0
  55. package/ios/UIImage+vImageScaling.h +16 -0
  56. package/ios/UIImage+vImageScaling.m +48 -0
  57. package/ios/UIPasteboard+GetImageInfo.h +19 -0
  58. package/ios/UIPasteboard+GetImageInfo.m +98 -0
  59. package/ios/generated/PasteTextInputSpecs/ComponentDescriptors.cpp +22 -0
  60. package/ios/generated/PasteTextInputSpecs/ComponentDescriptors.h +42 -0
  61. package/ios/generated/PasteTextInputSpecs/EventEmitters.cpp +41 -0
  62. package/ios/generated/PasteTextInputSpecs/EventEmitters.h +37 -0
  63. package/ios/generated/PasteTextInputSpecs/PasteTextInputSpecs-generated.mm +16 -0
  64. package/ios/generated/PasteTextInputSpecs/PasteTextInputSpecs.h +38 -0
  65. package/ios/generated/PasteTextInputSpecs/Props.cpp +142 -0
  66. package/ios/generated/PasteTextInputSpecs/Props.h +81 -0
  67. package/ios/generated/PasteTextInputSpecs/RCTComponentViewHelpers.h +106 -0
  68. package/ios/generated/PasteTextInputSpecs/ShadowNodes.cpp +127 -0
  69. package/ios/generated/PasteTextInputSpecs/ShadowNodes.h +85 -0
  70. package/ios/generated/PasteTextInputSpecs/States.cpp +16 -0
  71. package/ios/generated/PasteTextInputSpecs/States.h +53 -0
  72. package/ios/generated/PasteTextInputSpecsJSI-generated.cpp +17 -0
  73. package/ios/generated/PasteTextInputSpecsJSI.h +19 -0
  74. package/lib/commonjs/PasteTextInput.js +446 -0
  75. package/lib/commonjs/PasteTextInput.js.map +1 -0
  76. package/lib/commonjs/PasteTextInputNativeComponent.ts +277 -0
  77. package/lib/commonjs/index.js +25 -0
  78. package/lib/commonjs/index.js.map +1 -0
  79. package/lib/commonjs/module.d.js +2 -0
  80. package/lib/commonjs/module.d.js.map +1 -0
  81. package/lib/commonjs/package.json +1 -0
  82. package/lib/commonjs/types.js +6 -0
  83. package/lib/commonjs/types.js.map +1 -0
  84. package/lib/module/PasteTextInput.js +440 -0
  85. package/lib/module/PasteTextInput.js.map +1 -0
  86. package/lib/module/PasteTextInputNativeComponent.ts +277 -0
  87. package/lib/module/index.js +9 -0
  88. package/lib/module/index.js.map +1 -0
  89. package/lib/module/module.d.js +2 -0
  90. package/lib/module/module.d.js.map +1 -0
  91. package/lib/module/types.js +4 -0
  92. package/lib/module/types.js.map +1 -0
  93. package/lib/typescript/src/PasteTextInput.d.ts +5 -0
  94. package/lib/typescript/src/PasteTextInput.d.ts.map +1 -0
  95. package/lib/typescript/src/PasteTextInputNativeComponent.d.ts +168 -0
  96. package/lib/typescript/src/PasteTextInputNativeComponent.d.ts.map +1 -0
  97. package/lib/typescript/src/index.d.ts +6 -0
  98. package/lib/typescript/src/index.d.ts.map +1 -0
  99. package/lib/typescript/src/types.d.ts +56 -0
  100. package/lib/typescript/src/types.d.ts.map +1 -0
  101. package/package.json +140 -0
  102. package/react-native-paste-input.podspec +20 -0
  103. package/react-native.config.js +13 -0
  104. package/src/PasteTextInput.tsx +615 -0
  105. package/src/PasteTextInputNativeComponent.ts +277 -0
  106. package/src/index.ts +13 -0
  107. package/src/module.d.ts +4 -0
  108. package/src/types.ts +71 -0
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/PasteTextInputSpecs/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_PasteTextInputSpecs
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_PasteTextInputSpecs PUBLIC . react/renderer/components/PasteTextInputSpecs)
18
+
19
+ target_link_libraries(
20
+ react_codegen_PasteTextInputSpecs
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_PasteTextInputSpecs
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,27 @@
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: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "PasteTextInputSpecs.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ PasteTextInputSpecsJSI::PasteTextInputSpecsJSI(
16
+ const JavaTurboModule::InitParams &params)
17
+ : JavaTurboModule(params) {
18
+ // methodMap_["install"] =
19
+ // MethodMetadata{0, __hostFunction_NativeLiveMarkdownModuleSpecJSI_install};
20
+ }
21
+
22
+ std::shared_ptr<TurboModule> PasteTextInputSpecs_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
23
+
24
+ return nullptr;
25
+ }
26
+
27
+ } // namespace facebook::react
@@ -0,0 +1,28 @@
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: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+ #include <react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.h>
17
+
18
+ namespace facebook::react {
19
+
20
+ class JSI_EXPORT PasteTextInputSpecsJSI : public JavaTurboModule {
21
+ public:
22
+ PasteTextInputSpecsJSI(const JavaTurboModule::InitParams &params);
23
+ };
24
+
25
+ JSI_EXPORT
26
+ std::shared_ptr<TurboModule> PasteTextInputSpecs_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
27
+
28
+ } // namespace facebook::react
@@ -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 PasteTextInputSpecs_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+ registry->add(concreteComponentDescriptorProvider<PasteTextInputComponentDescriptor>());
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,166 @@
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 <unordered_map>
15
+ #include <yoga/YGEnums.h>
16
+ #include <yoga/YGValue.h>
17
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
18
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
19
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
20
+
21
+ namespace facebook::react {
22
+ class PasteTextInputComponentDescriptor final
23
+ : public ConcreteComponentDescriptor<PasteTextInputShadowNode> {
24
+ public:
25
+ PasteTextInputComponentDescriptor(
26
+ const ComponentDescriptorParameters& parameters)
27
+ : ConcreteComponentDescriptor<PasteTextInputShadowNode>(parameters),
28
+ textLayoutManager_(
29
+ std::make_shared<TextLayoutManager>(contextContainer_)) {}
30
+
31
+ virtual State::Shared createInitialState(
32
+ const Props::Shared& props,
33
+ const ShadowNodeFamily::Shared& family) const override {
34
+ int surfaceId = family->getSurfaceId();
35
+
36
+ ThemePadding theme;
37
+ // TODO: figure out RTL/start/end/left/right stuff here
38
+ if (surfaceIdToThemePaddingMap_.find(surfaceId) !=
39
+ surfaceIdToThemePaddingMap_.end()) {
40
+ theme = surfaceIdToThemePaddingMap_[surfaceId];
41
+ } else {
42
+ const jni::global_ref<jobject>& fabricUIManager =
43
+ contextContainer_->at<jni::global_ref<jobject>>("FabricUIManager");
44
+
45
+ auto env = jni::Environment::current();
46
+ auto defaultTextInputPaddingArray = env->NewFloatArray(4);
47
+ static auto getThemeData =
48
+ jni::findClassStatic(UIManagerJavaDescriptor)
49
+ ->getMethod<jboolean(jint, jfloatArray)>("getThemeData");
50
+
51
+ if (getThemeData(
52
+ fabricUIManager, surfaceId, defaultTextInputPaddingArray)) {
53
+ jfloat* defaultTextInputPadding =
54
+ env->GetFloatArrayElements(defaultTextInputPaddingArray, 0);
55
+ theme.start = defaultTextInputPadding[0];
56
+ theme.end = defaultTextInputPadding[1];
57
+ theme.top = defaultTextInputPadding[2];
58
+ theme.bottom = defaultTextInputPadding[3];
59
+ surfaceIdToThemePaddingMap_.emplace(std::make_pair(surfaceId, theme));
60
+ env->ReleaseFloatArrayElements(
61
+ defaultTextInputPaddingArray, defaultTextInputPadding, JNI_ABORT);
62
+ }
63
+ env->DeleteLocalRef(defaultTextInputPaddingArray);
64
+ }
65
+
66
+ return std::make_shared<PasteTextInputShadowNode::ConcreteState>(
67
+ std::make_shared<const TextInputState>(TextInputState({}, {}, {}, 0)),
68
+ family);
69
+ }
70
+
71
+ protected:
72
+ void adopt(ShadowNode& shadowNode) const override {
73
+ auto& textInputShadowNode =
74
+ static_cast<PasteTextInputShadowNode&>(shadowNode);
75
+
76
+ // `TextInputShadowNode` uses `TextLayoutManager` to measure text content
77
+ // and communicate text rendering metrics to mounting layer.
78
+ textInputShadowNode.setTextLayoutManager(textLayoutManager_);
79
+
80
+ int surfaceId = textInputShadowNode.getSurfaceId();
81
+ if (surfaceIdToThemePaddingMap_.find(surfaceId) !=
82
+ surfaceIdToThemePaddingMap_.end()) {
83
+ const auto& theme = surfaceIdToThemePaddingMap_[surfaceId];
84
+
85
+ auto& textInputProps = textInputShadowNode.getConcreteProps();
86
+
87
+ // Override padding
88
+ // Node is still unsealed during adoption, before layout is complete
89
+ // TODO: T62959168 account for RTL and paddingLeft when setting default
90
+ // paddingStart, and vice-versa with paddingRight/paddingEnd.
91
+ // For now this assumes no RTL.
92
+ auto& style = const_cast<yoga::Style&>(textInputProps.yogaStyle);
93
+ bool changedPadding = false;
94
+ if (!textInputProps.hasPadding && !textInputProps.hasPaddingStart &&
95
+ !textInputProps.hasPaddingLeft &&
96
+ !textInputProps.hasPaddingHorizontal) {
97
+ changedPadding = true;
98
+ style.setPadding(
99
+ yoga::Edge::Start, yoga::StyleLength::points(theme.start));
100
+ }
101
+ if (!textInputProps.hasPadding && !textInputProps.hasPaddingEnd &&
102
+ !textInputProps.hasPaddingRight &&
103
+ !textInputProps.hasPaddingHorizontal) {
104
+ changedPadding = true;
105
+ style.setPadding(yoga::Edge::End, yoga::StyleLength::points(theme.end));
106
+ }
107
+ if (!textInputProps.hasPadding && !textInputProps.hasPaddingTop &&
108
+ !textInputProps.hasPaddingVertical) {
109
+ changedPadding = true;
110
+ style.setPadding(yoga::Edge::Top, yoga::StyleLength::points(theme.top));
111
+ }
112
+ if (!textInputProps.hasPadding && !textInputProps.hasPaddingBottom &&
113
+ !textInputProps.hasPaddingVertical) {
114
+ changedPadding = true;
115
+ style.setPadding(
116
+ yoga::Edge::Bottom, yoga::StyleLength::points(theme.bottom));
117
+ }
118
+
119
+ // If the TextInput initially does not have paddingLeft or paddingStart, a
120
+ // paddingStart may be set from the theme. If that happens, when there's a
121
+ // paddingLeft update, we must explicitly unset paddingStart... (same with
122
+ // paddingEnd)
123
+ // TODO: support RTL
124
+ if ((textInputProps.hasPadding || textInputProps.hasPaddingLeft ||
125
+ textInputProps.hasPaddingHorizontal) &&
126
+ !textInputProps.hasPaddingStart) {
127
+ style.setPadding(yoga::Edge::Start, yoga::StyleLength::undefined());
128
+ }
129
+ if ((textInputProps.hasPadding || textInputProps.hasPaddingRight ||
130
+ textInputProps.hasPaddingHorizontal) &&
131
+ !textInputProps.hasPaddingEnd) {
132
+ style.setPadding(yoga::Edge::End, yoga::StyleLength::undefined());
133
+ }
134
+
135
+ // Note that this is expensive: on every adopt, we need to set the Yoga
136
+ // props again, which normally only happens during prop parsing. Every
137
+ // commit, state update, etc, will incur this cost.
138
+ if (changedPadding) {
139
+ // Communicate new props to Yoga part of the node
140
+ textInputShadowNode.updateYogaProps();
141
+ }
142
+ }
143
+
144
+ textInputShadowNode.dirtyLayout();
145
+
146
+ ConcreteComponentDescriptor::adopt(shadowNode);
147
+ }
148
+
149
+ private:
150
+ struct ThemePadding {
151
+ float start{};
152
+ float end{};
153
+ float top{};
154
+ float bottom{};
155
+ };
156
+
157
+ // TODO T68526882: Unify with Binding::UIManagerJavaDescriptor
158
+ constexpr static auto UIManagerJavaDescriptor =
159
+ "com/facebook/react/fabric/FabricUIManager";
160
+
161
+ const std::shared_ptr<TextLayoutManager> textLayoutManager_;
162
+ mutable std::unordered_map<int, ThemePadding> surfaceIdToThemePaddingMap_;
163
+ };
164
+
165
+
166
+ } // namespace facebook::react
@@ -0,0 +1,183 @@
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
+
13
+
14
+ namespace facebook::react {
15
+
16
+ void PasteTextInputEventEmitter::onBlur(OnBlur $event) const {
17
+ dispatchEvent("blur", [$event=std::move($event)](jsi::Runtime &runtime) {
18
+ auto $payload = jsi::Object(runtime);
19
+ $payload.setProperty(runtime, "target", $event.target);
20
+ return $payload;
21
+ });
22
+ }
23
+
24
+
25
+ void PasteTextInputEventEmitter::onChange(OnChange $event) const {
26
+ dispatchEvent("change", [$event=std::move($event)](jsi::Runtime &runtime) {
27
+ auto $payload = jsi::Object(runtime);
28
+ $payload.setProperty(runtime, "target", $event.target);
29
+ $payload.setProperty(runtime, "eventCount", $event.eventCount);
30
+ $payload.setProperty(runtime, "text", $event.text);
31
+ return $payload;
32
+ });
33
+ }
34
+
35
+
36
+ void PasteTextInputEventEmitter::onChangeText(OnChangeText $event) const {
37
+ dispatchEvent("changeText", [$event=std::move($event)](jsi::Runtime &runtime) {
38
+ auto $payload = jsi::Object(runtime);
39
+ $payload.setProperty(runtime, "target", $event.target);
40
+ $payload.setProperty(runtime, "eventCount", $event.eventCount);
41
+ $payload.setProperty(runtime, "text", $event.text);
42
+ return $payload;
43
+ });
44
+ }
45
+
46
+
47
+ void PasteTextInputEventEmitter::onEndEditing(OnEndEditing $event) const {
48
+ dispatchEvent("endEditing", [$event=std::move($event)](jsi::Runtime &runtime) {
49
+ auto $payload = jsi::Object(runtime);
50
+ $payload.setProperty(runtime, "target", $event.target);
51
+ $payload.setProperty(runtime, "text", $event.text);
52
+ return $payload;
53
+ });
54
+ }
55
+
56
+
57
+ void PasteTextInputEventEmitter::onFocus(OnFocus $event) const {
58
+ dispatchEvent("focus", [$event=std::move($event)](jsi::Runtime &runtime) {
59
+ auto $payload = jsi::Object(runtime);
60
+ $payload.setProperty(runtime, "target", $event.target);
61
+ return $payload;
62
+ });
63
+ }
64
+
65
+
66
+ void PasteTextInputEventEmitter::onKeyPress(OnKeyPress $event) const {
67
+ dispatchEvent("keyPress", [$event=std::move($event)](jsi::Runtime &runtime) {
68
+ auto $payload = jsi::Object(runtime);
69
+ $payload.setProperty(runtime, "target", $event.target);
70
+ $payload.setProperty(runtime, "key", $event.key);
71
+ return $payload;
72
+ });
73
+ }
74
+
75
+
76
+ void PasteTextInputEventEmitter::onPaste(OnPaste $event) const {
77
+ dispatchEvent("paste", [$event=std::move($event)](jsi::Runtime &runtime) {
78
+ auto $payload = jsi::Object(runtime);
79
+
80
+ auto data = jsi::Array(runtime, $event.data.size());
81
+ size_t dataIndex = 0;
82
+ for (auto dataValue : $event.data) {
83
+ auto dataObject = jsi::Object(runtime);
84
+ dataObject.setProperty(runtime, "fileName", dataValue.fileName);
85
+ dataObject.setProperty(runtime, "fileSize", dataValue.fileSize);
86
+ dataObject.setProperty(runtime, "type", dataValue.type);
87
+ dataObject.setProperty(runtime, "uri", dataValue.uri);
88
+ data.setValueAtIndex(runtime, dataIndex++, dataObject);
89
+ }
90
+ $payload.setProperty(runtime, "data", data);
91
+
92
+ {
93
+ auto error = jsi::Object(runtime);
94
+ error.setProperty(runtime, "message", $event.error.message);
95
+ $payload.setProperty(runtime, "error", error);
96
+ }
97
+ return $payload;
98
+ });
99
+ }
100
+
101
+
102
+ void PasteTextInputEventEmitter::onSubmitEdition(OnSubmitEdition $event) const {
103
+ dispatchEvent("submitEdition", [$event=std::move($event)](jsi::Runtime &runtime) {
104
+ auto $payload = jsi::Object(runtime);
105
+ $payload.setProperty(runtime, "target", $event.target);
106
+ $payload.setProperty(runtime, "text", $event.text);
107
+ return $payload;
108
+ });
109
+ }
110
+
111
+
112
+ void PasteTextInputEventEmitter::onContentSizeChange(OnContentSizeChange $event) const {
113
+ dispatchEvent("contentSizeChange", [$event=std::move($event)](jsi::Runtime &runtime) {
114
+ auto $payload = jsi::Object(runtime);
115
+ $payload.setProperty(runtime, "target", $event.target);
116
+ {
117
+ auto contentSize = jsi::Object(runtime);
118
+ contentSize.setProperty(runtime, "width", $event.contentSize.width);
119
+ contentSize.setProperty(runtime, "height", $event.contentSize.height);
120
+ $payload.setProperty(runtime, "contentSize", contentSize);
121
+ }
122
+ return $payload;
123
+ });
124
+ }
125
+
126
+
127
+ void PasteTextInputEventEmitter::onScroll(OnScroll $event) const {
128
+ dispatchEvent("scroll", [$event=std::move($event)](jsi::Runtime &runtime) {
129
+ auto $payload = jsi::Object(runtime);
130
+ $payload.setProperty(runtime, "target", $event.target);
131
+ {
132
+ auto contentInset = jsi::Object(runtime);
133
+ contentInset.setProperty(runtime, "top", $event.contentInset.top);
134
+ contentInset.setProperty(runtime, "bottom", $event.contentInset.bottom);
135
+ contentInset.setProperty(runtime, "left", $event.contentInset.left);
136
+ contentInset.setProperty(runtime, "right", $event.contentInset.right);
137
+ $payload.setProperty(runtime, "contentInset", contentInset);
138
+ }
139
+ {
140
+ auto contentOffset = jsi::Object(runtime);
141
+ contentOffset.setProperty(runtime, "x", $event.contentOffset.x);
142
+ contentOffset.setProperty(runtime, "y", $event.contentOffset.y);
143
+ $payload.setProperty(runtime, "contentOffset", contentOffset);
144
+ }
145
+ {
146
+ auto contentSize = jsi::Object(runtime);
147
+ contentSize.setProperty(runtime, "width", $event.contentSize.width);
148
+ contentSize.setProperty(runtime, "height", $event.contentSize.height);
149
+ $payload.setProperty(runtime, "contentSize", contentSize);
150
+ }
151
+ {
152
+ auto layoutMeasurement = jsi::Object(runtime);
153
+ layoutMeasurement.setProperty(runtime, "width", $event.layoutMeasurement.width);
154
+ layoutMeasurement.setProperty(runtime, "height", $event.layoutMeasurement.height);
155
+ $payload.setProperty(runtime, "layoutMeasurement", layoutMeasurement);
156
+ }
157
+ $payload.setProperty(runtime, "responderIgnoreScroll", $event.responderIgnoreScroll);
158
+ {
159
+ auto velocity = jsi::Object(runtime);
160
+ velocity.setProperty(runtime, "x", $event.velocity.x);
161
+ velocity.setProperty(runtime, "y", $event.velocity.y);
162
+ $payload.setProperty(runtime, "velocity", velocity);
163
+ }
164
+ return $payload;
165
+ });
166
+ }
167
+
168
+
169
+ void PasteTextInputEventEmitter::onSelectionChange(OnSelectionChange $event) const {
170
+ dispatchEvent("selectionChange", [$event=std::move($event)](jsi::Runtime &runtime) {
171
+ auto $payload = jsi::Object(runtime);
172
+ $payload.setProperty(runtime, "target", $event.target);
173
+ {
174
+ auto selection = jsi::Object(runtime);
175
+ selection.setProperty(runtime, "start", $event.selection.start);
176
+ selection.setProperty(runtime, "end", $event.selection.end);
177
+ $payload.setProperty(runtime, "selection", selection);
178
+ }
179
+ return $payload;
180
+ });
181
+ }
182
+
183
+ } // namespace facebook::react
@@ -0,0 +1,148 @@
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
+
14
+ namespace facebook::react {
15
+ class PasteTextInputEventEmitter : public ViewEventEmitter {
16
+ public:
17
+ using ViewEventEmitter::ViewEventEmitter;
18
+
19
+ struct OnBlur {
20
+ int target;
21
+ };
22
+
23
+ struct OnChange {
24
+ int target;
25
+ int eventCount;
26
+ std::string text;
27
+ };
28
+
29
+ struct OnChangeText {
30
+ int target;
31
+ int eventCount;
32
+ std::string text;
33
+ };
34
+
35
+ struct OnEndEditing {
36
+ int target;
37
+ std::string text;
38
+ };
39
+
40
+ struct OnFocus {
41
+ int target;
42
+ };
43
+
44
+ struct OnKeyPress {
45
+ int target;
46
+ std::string key;
47
+ };
48
+
49
+ struct OnPasteData {
50
+ std::string fileName;
51
+ int fileSize;
52
+ std::string type;
53
+ std::string uri;
54
+ };
55
+
56
+ struct OnPasteError {
57
+ std::string message;
58
+ };
59
+
60
+ struct OnPaste {
61
+ std::vector<OnPasteData> data;
62
+ OnPasteError error;
63
+ };
64
+
65
+ struct OnSubmitEdition {
66
+ int target;
67
+ std::string text;
68
+ };
69
+
70
+ struct OnContentSizeChangeContentSize {
71
+ int width;
72
+ int height;
73
+ };
74
+
75
+ struct OnContentSizeChange {
76
+ int target;
77
+ OnContentSizeChangeContentSize contentSize;
78
+ };
79
+
80
+ struct OnScrollContentInset {
81
+ double top;
82
+ double bottom;
83
+ double left;
84
+ double right;
85
+ };
86
+
87
+ struct OnScrollContentOffset {
88
+ double x;
89
+ double y;
90
+ };
91
+
92
+ struct OnScrollContentSize {
93
+ double width;
94
+ double height;
95
+ };
96
+
97
+ struct OnScrollLayoutMeasurement {
98
+ double width;
99
+ double height;
100
+ };
101
+
102
+ struct OnScrollVelocity {
103
+ double x;
104
+ double y;
105
+ };
106
+
107
+ struct OnScroll {
108
+ int target;
109
+ OnScrollContentInset contentInset;
110
+ OnScrollContentOffset contentOffset;
111
+ OnScrollContentSize contentSize;
112
+ OnScrollLayoutMeasurement layoutMeasurement;
113
+ bool responderIgnoreScroll;
114
+ OnScrollVelocity velocity;
115
+ };
116
+
117
+ struct OnSelectionChangeSelection {
118
+ int start;
119
+ int end;
120
+ };
121
+
122
+ struct OnSelectionChange {
123
+ int target;
124
+ OnSelectionChangeSelection selection;
125
+ };
126
+ void onBlur(OnBlur value) const;
127
+
128
+ void onChange(OnChange value) const;
129
+
130
+ void onChangeText(OnChangeText value) const;
131
+
132
+ void onEndEditing(OnEndEditing value) const;
133
+
134
+ void onFocus(OnFocus value) const;
135
+
136
+ void onKeyPress(OnKeyPress value) const;
137
+
138
+ void onPaste(OnPaste value) const;
139
+
140
+ void onSubmitEdition(OnSubmitEdition value) const;
141
+
142
+ void onContentSizeChange(OnContentSizeChange value) const;
143
+
144
+ void onScroll(OnScroll value) const;
145
+
146
+ void onSelectionChange(OnSelectionChange value) const;
147
+ };
148
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
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: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "PasteTextInputSpecsJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
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: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react