Share TextInputEventEmitter between C++ platforms (#46198)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46198

Extending on https://github.com/facebook/react-native/pull/43431 this change allows to share the TextInputEventEmitter with our C++ based platforms such as RN Windows > https://github.com/microsoft/react-native-windows/blob/main/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h

## Changelog:
[Internal] - Share TextInputEventEmitter between C++ platforms

Reviewed By: NickGerleman

Differential Revision: D61749959

fbshipit-source-id: 2526bf29200cd6a3dc6d5eaef5edbaf4b1df5751
This commit is contained in:
Christoph Purrer
2024-10-01 12:35:16 -07:00
committed by Facebook GitHub Bot
parent aa55d765e5
commit 1118cc6327
4 changed files with 7 additions and 3 deletions
@@ -153,7 +153,8 @@ Pod::Spec.new do |s|
ss.subspec "iostextinput" do |sss|
sss.dependency folly_dep_name, folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "react/renderer/components/textinput/platform/ios/**/*.{m,mm,cpp,h}"
sss.source_files = "react/renderer/components/textinput/**/*.{m,mm,cpp,h}"
sss.exclude_files = "react/renderer/components/textinput/platform/android"
sss.header_dir = "react/renderer/components/iostextinput"
end
@@ -19,6 +19,8 @@ static jsi::Value textInputMetricsPayload(
"text",
jsi::String::createFromUtf8(runtime, textInputMetrics.text));
payload.setProperty(runtime, "target", textInputMetrics.target);
payload.setProperty(runtime, "eventCount", textInputMetrics.eventCount);
{
@@ -81,7 +83,7 @@ static jsi::Value textInputMetricsScrollPayload(
payload.setProperty(
runtime,
"zoomScale",
textInputMetrics.zoomScale ? textInputMetrics.zoomScale : 1);
textInputMetrics.zoomScale != 0.0f ? textInputMetrics.zoomScale : 1);
return payload;
};
@@ -27,6 +27,7 @@ class TextInputEventEmitter : public ViewEventEmitter {
int eventCount;
Size layoutMeasurement;
Float zoomScale;
Tag target;
};
struct KeyPressMetrics {
@@ -8,10 +8,10 @@
#pragma once
#include <react/renderer/attributedstring/AttributedString.h>
#include <react/renderer/components/iostextinput/TextInputEventEmitter.h>
#include <react/renderer/components/iostextinput/TextInputProps.h>
#include <react/renderer/components/iostextinput/TextInputState.h>
#include <react/renderer/components/text/BaseTextShadowNode.h>
#include <react/renderer/components/textinput/TextInputEventEmitter.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
#include <react/utils/ContextContainer.h>