Skip to content

[Native] Fix ButtonWrapper Shadow Node custom layout logic#3974

Merged
akwasniewski merged 5 commits intomainfrom
@akwasniewski/ios-fix-pressable
Feb 13, 2026
Merged

[Native] Fix ButtonWrapper Shadow Node custom layout logic#3974
akwasniewski merged 5 commits intomainfrom
@akwasniewski/ios-fix-pressable

Conversation

@akwasniewski
Copy link
Contributor

Description

After #3634 the Pressable did not work on iOS.
The reason lied in the shadow node of the button wrapper introduced in aforementioned PR which took the layout of the button and instead of changing its own layout to the button's it changed the child view's layout. As a result, the detector got bounds (0,0,0,0) thus all the non-native were considered out of bounds. This broke pressable as it relies on longPress to register touches.

Test plan

Tested on the following code

Details
import React from 'react';
import { Text, StyleSheet, View } from 'react-native';
import { Pressable, GestureHandlerRootView } from 'react-native-gesture-handler'

const PressableExample = () => {
  const [count, setCount] = React.useState(0);
  return (
    <GestureHandlerRootView style={styles.container}>
      <Pressable onPress={() => setCount((c) => c + 1)}>
        <View style={styles.pressable}>
          <Text>{count}</Text>
        </View>
      </Pressable>
    </GestureHandlerRootView >
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  pressable: {
    alignItems: 'center', justifyContent: 'center', backgroundColor: 'green', width: 100, height: 100
  },
  wrapperCustom: {
    borderRadius: 8,
    padding: 16,
    minWidth: 150,
    alignItems: 'center',
  },
  text: {
    fontSize: 18,
    color: 'white',
    fontWeight: '600',
  },
});

export default PressableExample;

@j-piasecki j-piasecki changed the title iOS fix pressable [Native] Fix ButtonWrapper Shadow Node custom layout logic Feb 13, 2026
@akwasniewski akwasniewski merged commit 06aab22 into main Feb 13, 2026
@akwasniewski akwasniewski deleted the @akwasniewski/ios-fix-pressable branch February 13, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants