Skip to content

Commit ef05bac

Browse files
committed
fix: other scroll events
1 parent 8723cea commit ef05bac

13 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/react-native/Libraries/Components/TextInput/TextInput.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
440440
*/
441441
export interface TextInputScrollEventData {
442442
contentOffset: {x: number; y: number};
443+
responderIgnoreScroll?: boolean;
443444
}
444445

445446
/**

packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,9 @@ - (void)textInputDidChangeSelection
530530
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
531531
{
532532
if (_eventEmitter) {
533-
static_cast<const TextInputEventEmitter &>(*_eventEmitter).onScroll([self _textInputMetrics]);
533+
auto metrics = [self _textInputMetrics];
534+
metrics.responderIgnoreScroll = !(scrollView.isDragging || scrollView.isDecelerating);
535+
static_cast<const TextInputEventEmitter &>(*_eventEmitter).onScroll(metrics);
534536
}
535537
}
536538

packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ static jsi::Value textInputMetricsScrollPayload(
8686
"zoomScale",
8787
textInputMetrics.zoomScale != 0.0f ? textInputMetrics.zoomScale : 1);
8888

89+
payload.setProperty(
90+
runtime, "responderIgnoreScroll", textInputMetrics.responderIgnoreScroll);
91+
8992
return payload;
9093
};
9194

packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class TextInputEventEmitter : public ViewEventEmitter {
2727
int eventCount;
2828
Size layoutMeasurement;
2929
Float zoomScale;
30+
bool responderIgnoreScroll{false};
3031
Tag target;
3132
};
3233

scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5031,6 +5031,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
50315031
}
50325032

50335033
struct facebook::react::TextInputEventEmitter::Metrics {
5034+
public bool responderIgnoreScroll;
50345035
public facebook::react::AttributedString::Range selectionRange;
50355036
public facebook::react::EdgeInsets contentInset;
50365037
public facebook::react::Float zoomScale;

scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4842,6 +4842,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
48424842
}
48434843

48444844
struct facebook::react::TextInputEventEmitter::Metrics {
4845+
public bool responderIgnoreScroll;
48454846
public facebook::react::AttributedString::Range selectionRange;
48464847
public facebook::react::EdgeInsets contentInset;
48474848
public facebook::react::Float zoomScale;

scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5022,6 +5022,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
50225022
}
50235023

50245024
struct facebook::react::TextInputEventEmitter::Metrics {
5025+
public bool responderIgnoreScroll;
50255026
public facebook::react::AttributedString::Range selectionRange;
50265027
public facebook::react::EdgeInsets contentInset;
50275028
public facebook::react::Float zoomScale;

scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7217,6 +7217,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
72177217
}
72187218

72197219
struct facebook::react::TextInputEventEmitter::Metrics {
7220+
public bool responderIgnoreScroll;
72207221
public facebook::react::AttributedString::Range selectionRange;
72217222
public facebook::react::EdgeInsets contentInset;
72227223
public facebook::react::Float zoomScale;

scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7056,6 +7056,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
70567056
}
70577057

70587058
struct facebook::react::TextInputEventEmitter::Metrics {
7059+
public bool responderIgnoreScroll;
70597060
public facebook::react::AttributedString::Range selectionRange;
70607061
public facebook::react::EdgeInsets contentInset;
70617062
public facebook::react::Float zoomScale;

scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7208,6 +7208,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
72087208
}
72097209

72107210
struct facebook::react::TextInputEventEmitter::Metrics {
7211+
public bool responderIgnoreScroll;
72117212
public facebook::react::AttributedString::Range selectionRange;
72127213
public facebook::react::EdgeInsets contentInset;
72137214
public facebook::react::Float zoomScale;

0 commit comments

Comments
 (0)