Skip to content

PointerLeave doesn't fire without another pointer target. #14672

Closed

Description

@acoates-ms

Problem Description

The below example requires the outer view have some dummy no-op onPointer events in order for the inner view to property get the PointerLeave event.

We should work out why thats required, and fix it.

Steps To Reproduce

import React from 'react';
import {AppRegistry, View} from 'react-native';

const noop = () => {};

const Bootstrap = () => {
  const [hover, setHover] = React.useState(false);
  const setHoverTrue = React.useCallback(() => setHover(true), [setHover]);
  const setHoverFalse = React.useCallback(() => setHover(false), [setHover]);
  return (
    <View
      style={{flexDirection: 'row', gap: 8}}
      onPointerEnter={noop}
      onPointerLeave={noop}>
      <View
        onPointerEnter={setHoverTrue}
        onPointerLeave={setHoverFalse}
        style={{
          margin: 5,
          width: 100,
          height: 100,
          backgroundColor: hover ? 'red' : 'green',
        }}></View>
    </View>
  );
};

AppRegistry.registerComponent('Bootstrap', () => Bootstrap);

Expected Results

No response

CLI version

npx @react-native-community/cli -v

Environment

npx @react-native-community/cli info

Community Modules

No response

Target Platform Version

None

Target Device(s)

No response

Visual Studio Version

None

Build Configuration

None

Snack, code example, screenshot, or link to a repository

No response

Activity

  1. added
    Needs: Triage 🔍
    on May 15, 2025
  2. added
    New Architecture
    on May 22, 2025
  3. jonthysell commented on May 22, 2025

    @jonthysell
    Contributor

    Leave doesn't fire until Enter fires on something else.

  4. added this to the Next milestone on May 22, 2025
  5. removed
    Needs: Triage 🔍
    on May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: Component ViewsArea: ViewNew Architecturebug

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions