Skip to content

Fabric: a ScrollView's hitSlop past its parent's box never widens the parent's overflowInset, as getContentBounds reads hitSlop only from a View child #60278

Backlog

Description

@YevheniiKotyrlo

Description

A hitSlop that reaches past the parent's box widens the parent's overflowInset when the child is a View, but not when it is a ScrollView with the same hitSlop. YogaLayoutableShadowNode::getContentBounds outsets each child's frame by its hitSlop, but reads hitSlop only from a child whose component handle is ViewShadowNode's, and takes EdgeInsets{} for every other child (YogaLayoutableShadowNode.cpp#L894-L923). hitSlop is a BaseViewProps field (BaseViewProps.h#L104), so ScrollView and every other component whose props derive from ViewProps parse it.

Android's TouchTargetHelper does not look into a view for a touch outside its overflowInset (TouchTargetHelper.kt#L192-L195, #L276-L283), and iOS's RCTViewComponentView returns no hit for a point outside a view whose overflowInset is empty (RCTViewComponentView.mm#L929-L935), so the part of such a child's hitSlop outside its parent is never reached.

Steps to reproduce

  1. git clone https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer && cd react-native-fantom-reproducer
  2. ./fantom/reproduce.sh hit-slop-content-bounds (needs Docker). It clones react/react-native at main, builds Fantom's tester, and runs packages/react-native/Libraries/Components/View/__tests__/HitSlopContentBounds-itest.js, its license and Flow header left out here:
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';

import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {ScrollView, View} from 'react-native';

const hitSlop = {top: 0, left: 0, bottom: 0, right: 80};
const renderOptions = {
  includeLayoutMetrics: true,
  props: ['^layoutMetrics-overflowInset$'],
};

describe("a child's hitSlop past its parent's box", () => {
  it("widens the parent's overflowInset for a View child", () => {
    const root = Fantom.createRoot();
    Fantom.runTask(() => {
      root.render(
        <View collapsable={false} style={{width: 100, height: 100}}>
          <View
            collapsable={false}
            hitSlop={hitSlop}
            style={{width: 40, height: 40}}
          />
        </View>,
      );
    });
    const parent = root.getRenderedOutput(renderOptions).toJSONObject();
    expect(parent.props['layoutMetrics-overflowInset']).toBe(
      '{top:0,right:-20,bottom:-0,left:0}',
    );
  });

  it("widens the parent's overflowInset for a ScrollView child", () => {
    const root = Fantom.createRoot();
    Fantom.runTask(() => {
      root.render(
        <View collapsable={false} style={{width: 100, height: 100}}>
          <ScrollView hitSlop={hitSlop} style={{width: 40, height: 40}} />
        </View>,
      );
    });
    const parent = root.getRenderedOutput(renderOptions).toJSONObject();
    expect(parent.props['layoutMetrics-overflowInset']).toBe(
      '{top:0,right:-20,bottom:-0,left:0}',
    );
  });
});

The same on a checkout of main: put the file in place, then yarn workspace @react-native/fantom build and yarn fantom packages/react-native/Libraries/Components/View/__tests__/HitSlopContentBounds-itest.js. The script ends with a SUMMARY: line and exits 1 while the View child widens the parent's overflowInset and the ScrollView child leaves it at right:-0, 0 once both widen it to right:-20, and 2 when the tester does not build or the test fails another way.

Expected: the 40x40 child's hitSlop reaches 20 past the 100x100 parent's right edge, so the parent's overflowInset is {top:0,right:-20,bottom:-0,left:0} for the ScrollView child as for the View child.

Seen: {top:0,right:-20,bottom:-0,left:0} for the View child; {top:0,right:-0,bottom:-0,left:0} for the ScrollView child.

React Native Version

main at 17579b5 (0.88.0 reads hitSlop in getContentBounds the same way, through a dynamic_cast to ViewShadowNode)

Affected Platforms

Runtime - Android, Runtime - iOS, Build - Linux

Areas

Fabric - The New Renderer

Output of npx @react-native-community/cli info

react-native 17579b5879bff566a86aeea516da74b56388fff7, committed 2026-11-24T22:39:27+00:00
clang version 23.1.3 (https://github.com/llvm/llvm-project 0d261d1ca552c95a8f007e061c787ac7132fbcbc)

Built and run in reactnativecommunity/react-native-android:v22.0 under Docker, as Fantom's CI job builds the tester, with LLVM 23.1.3's Clang.

Stacktrace or Logs

FAIL fantom packages/react-native/Libraries/Components/View/__tests__/HitSlopContentBounds-itest.js (7.144 s)
  a child's hitSlop past its parent's box (hermes)
    ✓ widens the parent's overflowInset for a View child (55 ms)
    ✕ widens the parent's overflowInset for a ScrollView child (29 ms)

  ● a child's hitSlop past its parent's box (hermes) › widens the parent's overflowInset for a ScrollView child

    Expected {top:0,right:-20,bottom:-0,left:0} but received {top:0,right:-0,bottom:-0,left:0}.
[…]
Tests:       1 failed, 1 passed, 2 total
[…]
SUMMARY: a View child's hitSlop widens its parent's overflowInset to right:-20; a ScrollView child's with the same hitSlop leaves it at right:-0

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer

Screenshots and Videos

No response

Activity

  1. added
    Type: New Architecture
    on Nov 24, 2026
  2. added a commit that references this issue on Nov 30, 2026
    aefb4b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: ScrollViewFlowNeeds: Triage 🔍Type: New Architecture

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions