Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ - (BOOL)_shouldDisableScrollInteraction
metrics.containerSize = RCTSizeFromCGSize(_scrollView.bounds.size);
metrics.zoomScale = _scrollView.zoomScale;
metrics.timestamp = CACurrentMediaTime();
metrics.responderIgnoreScroll = !_isUserTriggeredScrolling;

if (_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) {
metrics.contentOffset.x = metrics.contentSize.width - metrics.containerSize.width - metrics.contentOffset.x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ - (void)textInputDidChangeSelection
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (_eventEmitter) {
static_cast<const TextInputEventEmitter &>(*_eventEmitter).onScroll([self _textInputMetrics]);
auto metrics = [self _textInputMetrics];
metrics.responderIgnoreScroll = !(scrollView.isDragging || scrollView.isDecelerating);
static_cast<const TextInputEventEmitter &>(*_eventEmitter).onScroll(metrics);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jsi::Value ScrollEvent::asJSIValue(jsi::Runtime& runtime) const {

payload.setProperty(runtime, "zoomScale", zoomScale);
payload.setProperty(runtime, "timestamp", timestamp * 1000);
payload.setProperty(runtime, "responderIgnoreScroll", responderIgnoreScroll);

return payload;
}
Expand All @@ -67,7 +68,8 @@ folly::dynamic ScrollEvent::asDynamic() const {
"contentInset", std::move(contentInsetObj))(
"contentSize", std::move(contentSizeObj))(
"layoutMeasurement", std::move(containerSizeObj))(
"zoomScale", zoomScale)("timestamp", timestamp * 1000);
"zoomScale", zoomScale)("timestamp", timestamp * 1000)(
"responderIgnoreScroll", responderIgnoreScroll);

return metrics;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct ScrollEvent : public EventPayload {
EdgeInsets contentInset;
Size containerSize;
Float zoomScale{};
bool responderIgnoreScroll{false};

/*
* The time in seconds when the touch occurred or when it was last mutated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ static jsi::Value textInputMetricsScrollPayload(
"zoomScale",
textInputMetrics.zoomScale != 0.0f ? textInputMetrics.zoomScale : 1);

payload.setProperty(
runtime, "responderIgnoreScroll", textInputMetrics.responderIgnoreScroll);

return payload;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class TextInputEventEmitter : public ViewEventEmitter {
int eventCount;
Size layoutMeasurement;
Float zoomScale;
bool responderIgnoreScroll{false};
Tag target;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
*/
export interface TextInputScrollEventData {
contentOffset: {x: number; y: number};
responderIgnoreScroll?: boolean | undefined;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -5070,6 +5070,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
}

struct facebook::react::TextInputEventEmitter::Metrics {
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float zoomScale;
Expand Down Expand Up @@ -7901,6 +7902,7 @@ struct facebook::react::ScrollEndDragEvent : public facebook::react::ScrollEvent

struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float timestamp;
public facebook::react::Float zoomScale;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -4881,6 +4881,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
}

struct facebook::react::TextInputEventEmitter::Metrics {
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float zoomScale;
Expand Down Expand Up @@ -7662,6 +7663,7 @@ struct facebook::react::ScrollEndDragEvent : public facebook::react::ScrollEvent

struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float timestamp;
public facebook::react::Float zoomScale;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -5061,6 +5061,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
}

struct facebook::react::TextInputEventEmitter::Metrics {
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float zoomScale;
Expand Down Expand Up @@ -7892,6 +7893,7 @@ struct facebook::react::ScrollEndDragEvent : public facebook::react::ScrollEvent

struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float timestamp;
public facebook::react::Float zoomScale;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -7244,6 +7244,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
}

struct facebook::react::TextInputEventEmitter::Metrics {
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float zoomScale;
Expand Down Expand Up @@ -9920,6 +9921,7 @@ struct facebook::react::ScrollEndDragEvent : public facebook::react::ScrollEvent

struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float timestamp;
public facebook::react::Float zoomScale;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -7087,6 +7087,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
}

struct facebook::react::TextInputEventEmitter::Metrics {
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float zoomScale;
Expand Down Expand Up @@ -9737,6 +9738,7 @@ struct facebook::react::ScrollEndDragEvent : public facebook::react::ScrollEvent

struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float timestamp;
public facebook::react::Float zoomScale;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -7235,6 +7235,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {
}

struct facebook::react::TextInputEventEmitter::Metrics {
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float zoomScale;
Expand Down Expand Up @@ -9911,6 +9912,7 @@ struct facebook::react::ScrollEndDragEvent : public facebook::react::ScrollEvent

struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Float timestamp;
public facebook::react::Float zoomScale;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -3561,6 +3561,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {

struct facebook::react::TextInputEventEmitter::Metrics {
public Float zoomScale;
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Point contentOffset;
Expand Down Expand Up @@ -6022,6 +6023,7 @@ struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public Float timestamp;
public Float zoomScale;
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Point contentOffset;
public facebook::react::Size containerSize;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -3412,6 +3412,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {

struct facebook::react::TextInputEventEmitter::Metrics {
public Float zoomScale;
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Point contentOffset;
Expand Down Expand Up @@ -5847,6 +5848,7 @@ struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public Float timestamp;
public Float zoomScale;
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Point contentOffset;
public facebook::react::Size containerSize;
Expand Down
2 changes: 2 additions & 0 deletions scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,7 @@ struct facebook::react::TextInputEventEmitter::KeyPressMetrics {

struct facebook::react::TextInputEventEmitter::Metrics {
public Float zoomScale;
public bool responderIgnoreScroll;
public facebook::react::AttributedString::Range selectionRange;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Point contentOffset;
Expand Down Expand Up @@ -6013,6 +6014,7 @@ struct facebook::react::ScrollEvent : public facebook::react::EventPayload {
public Float timestamp;
public Float zoomScale;
public ScrollEvent() = default;
public bool responderIgnoreScroll;
public facebook::react::EdgeInsets contentInset;
public facebook::react::Point contentOffset;
public facebook::react::Size containerSize;
Expand Down
Loading