Skip to content

Conversation

@akwasniewski
Copy link
Contributor

Description

V3 implementation of pressable component

Test plan

Tested on the following example

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

const PressableExample = () => {
  return (
    <GestureHandlerRootView style={styles.container}>
      <Pressable onPressOut={() => console.log("pressed")}
        style={({ pressed }) => [
          {
            backgroundColor: pressed ? 'darkseagreen' : 'seagreen',
          },
          styles.wrapperCustom,
        ]}
      >
        {({ pressed }) => (
          <Text style={styles.text}>
            {pressed ? 'Pressed!' : 'Press Me'}
          </Text>
        )}
      </Pressable>
    </GestureHandlerRootView >
  );
};

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

export default PressableExample;

@akwasniewski akwasniewski changed the base branch from main to next January 8, 2026 14:57
@akwasniewski akwasniewski changed the title @akwasniewski/v3 pressable V3 pressable Jan 8, 2026
@akwasniewski akwasniewski marked this pull request as draft January 8, 2026 14:57
@akwasniewski
Copy link
Contributor Author

Note that I temporarily reverted the broken changes in the shadow node. Without it, the pressable breaks on both android and ios. This change will be reverted before merge.

@akwasniewski akwasniewski marked this pull request as ready for review January 15, 2026 21:23
Comment on lines 149 to 153
export type {
PressableProps,
PressableStateCallbackType,
} from './components/Pressable';
export { default as Pressable } from './components/Pressable';
PressableProps as LegacyPressableProps,
PressableStateCallbackType as LegacyPressableCallbackType,
} from './v3/components/Pressable';
export { default as LegacyPressable } from './v3/components/Pressable';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the new one should be exported as Legacy (and we probably want to export the legacy one).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to remove 'v3' from path yesterday 😅. Fixed in ae6e532

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.

3 participants