From d2a7cce3e7e9cb8199678d53ed78579741a919cc Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Date: Tue, 4 Jul 2023 00:03:18 -0300 Subject: [PATCH] feat: Add id prop to Touchable components --- .../Libraries/Components/Touchable/TouchableBounce.js | 2 +- .../Libraries/Components/Touchable/TouchableHighlight.js | 2 +- .../Libraries/Components/Touchable/TouchableNativeFeedback.js | 2 +- .../Libraries/Components/Touchable/TouchableOpacity.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js index 5a8d97e85c0f..4fcbe801e160 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js @@ -181,7 +181,7 @@ class TouchableBounce extends React.Component { accessibilityElementsHidden={ this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden } - nativeID={this.props.nativeID} + nativeID={this.props.id ?? this.props.nativeID} testID={this.props.testID} hitSlop={this.props.hitSlop} focusable={ diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index c937344451ce..998a7d02f3b4 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -344,7 +344,7 @@ class TouchableHighlight extends React.Component { focusable={ this.props.focusable !== false && this.props.onPress !== undefined } - nativeID={this.props.nativeID} + nativeID={this.props.id ?? this.props.nativeID} testID={this.props.testID} ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index 2571ddd0b7ab..5c5aa5a31daf 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -322,7 +322,7 @@ class TouchableNativeFeedback extends React.Component { this.props.focusable !== false && this.props.onPress !== undefined && !this.props.disabled, - nativeID: this.props.nativeID, + nativeID: this.props.id ?? this.props.nativeID, nextFocusDown: this.props.nextFocusDown, nextFocusForward: this.props.nextFocusForward, nextFocusLeft: this.props.nextFocusLeft, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 02dc8abd365b..eff9b2bed400 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -275,7 +275,7 @@ class TouchableOpacity extends React.Component { this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden } style={[this.props.style, {opacity: this.state.anim}]} - nativeID={this.props.nativeID} + nativeID={this.props.id ?? this.props.nativeID} testID={this.props.testID} onLayout={this.props.onLayout} nextFocusDown={this.props.nextFocusDown}