From d2edc716197d09b27f1b621701bdbebaed49b56d Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 5 Jul 2024 01:53:08 -0700 Subject: [PATCH] Add reproducer to RN-Tester for #44610 (#45293) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45293 I'm justing adding a repro to RN-Tester to further investigate: https://github.com/facebook/react-native/issues/44610 Changelog: [Internal] [Changed] - Add reproducer to RN-Tester for #44610 Reviewed By: yungsters Differential Revision: D59375787 fbshipit-source-id: 3bc4f45e3686109bf731008bc27e47c4eb314e48 --- .../js/examples/Pressable/PressableExample.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/rn-tester/js/examples/Pressable/PressableExample.js b/packages/rn-tester/js/examples/Pressable/PressableExample.js index 6dfe4be3031..a64fd74fdce 100644 --- a/packages/rn-tester/js/examples/Pressable/PressableExample.js +++ b/packages/rn-tester/js/examples/Pressable/PressableExample.js @@ -321,6 +321,9 @@ const styles = StyleSheet.create({ wrapperCustom: { borderRadius: 8, padding: 6, + width: '100%', + justifyContent: 'center', + alignItems: 'center', }, hitSlopWrapper: { backgroundColor: 'red', @@ -390,6 +393,33 @@ const examples = [ ); }, }, + { + title: 'Change child based on Press', + description: + ('You should be able to press the button, move your finger while pressing, and release it with the proper status updates.': string), + render(): React.Node { + return ( + + [ + { + backgroundColor: pressed ? 'rgb(210, 230, 255)' : 'white', + }, + styles.wrapperCustom, + ]}> + {({pressed}) => ( + <> + {pressed && Pressed!} + {!pressed && ( + Press me and move your finger + )} + + )} + + + ); + }, + }, { title: 'Pressable feedback events', description: (' components accept onPress, onPressIn, ' +