@@ -36,6 +36,56 @@ static jsi::Value textInputMetricsPayload(
36
36
return payload;
37
37
};
38
38
39
+ static jsi::Value textInputMetricsScrollPayload (
40
+ jsi::Runtime& runtime,
41
+ const TextInputMetrics& textInputMetrics) {
42
+ auto payload = jsi::Object (runtime);
43
+
44
+ {
45
+ auto contentOffset = jsi::Object (runtime);
46
+ contentOffset.setProperty (runtime, " x" , textInputMetrics.contentOffset .x );
47
+ contentOffset.setProperty (runtime, " y" , textInputMetrics.contentOffset .y );
48
+ payload.setProperty (runtime, " contentOffset" , contentOffset);
49
+ }
50
+
51
+ {
52
+ auto contentInset = jsi::Object (runtime);
53
+ contentInset.setProperty (runtime, " top" , textInputMetrics.contentInset .top );
54
+ contentInset.setProperty (
55
+ runtime, " left" , textInputMetrics.contentInset .left );
56
+ contentInset.setProperty (
57
+ runtime, " bottom" , textInputMetrics.contentInset .bottom );
58
+ contentInset.setProperty (
59
+ runtime, " right" , textInputMetrics.contentInset .right );
60
+ payload.setProperty (runtime, " contentInset" , contentInset);
61
+ }
62
+
63
+ {
64
+ auto contentSize = jsi::Object (runtime);
65
+ contentSize.setProperty (
66
+ runtime, " width" , textInputMetrics.contentSize .width );
67
+ contentSize.setProperty (
68
+ runtime, " height" , textInputMetrics.contentSize .height );
69
+ payload.setProperty (runtime, " contentSize" , contentSize);
70
+ }
71
+
72
+ {
73
+ auto layoutMeasurement = jsi::Object (runtime);
74
+ layoutMeasurement.setProperty (
75
+ runtime, " width" , textInputMetrics.layoutMeasurement .width );
76
+ layoutMeasurement.setProperty (
77
+ runtime, " height" , textInputMetrics.layoutMeasurement .height );
78
+ payload.setProperty (runtime, " layoutMeasurement" , layoutMeasurement);
79
+ }
80
+
81
+ payload.setProperty (
82
+ runtime,
83
+ " zoomScale" ,
84
+ textInputMetrics.zoomScale ? textInputMetrics.zoomScale : 1 );
85
+
86
+ return payload;
87
+ };
88
+
39
89
static jsi::Value textInputMetricsContentSizePayload (
40
90
jsi::Runtime& runtime,
41
91
const TextInputMetrics& textInputMetrics) {
@@ -140,7 +190,9 @@ void TextInputEventEmitter::onKeyPressSync(
140
190
141
191
void TextInputEventEmitter::onScroll (
142
192
const TextInputMetrics& textInputMetrics) const {
143
- dispatchTextInputEvent (" scroll" , textInputMetrics);
193
+ dispatchEvent (" scroll" , [textInputMetrics](jsi::Runtime& runtime) {
194
+ return textInputMetricsScrollPayload (runtime, textInputMetrics);
195
+ });
144
196
}
145
197
146
198
void TextInputEventEmitter::dispatchTextInputEvent (
0 commit comments