[0.61.0-rc.0] TouchableNativeFeedback.SelectableBackgroundBorderless() is affecting adjacent components
See original GitHub issueDescription:
When using TouchableNativeFeedback with
background={TouchableNativeFeedback.SelectableBackgroundBorderless()}
It is breaking components that share the same parent, specifically when elevation and or borderRadius is used.
- Applying border radius will not display inner children background colour
- Setting Elevation will not apply the border radius correctly.
- Fast refresh will display the expected result when updating value, but hard refresh, or release build results in the unexpected behavior again.
React Native version:
System: OS: macOS 10.14.6 CPU: (12) x64 Intel® Core™ i7-8700K CPU @ 3.70GHz Memory: 799.25 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 26.0.3, 27.0.3, 28.0.3, 29.0.2 System Images: android-26 | Google APIs Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.0-rc.0 => 0.61.0-rc.0 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7
Steps To Reproduce
- init new project with 0.61.0-rc.0
- Replace app contents with code below
import React from 'react';
import {View, StyleSheet, TouchableNativeFeedback, Text} from 'react-native';
function App() {
return (
<View style={styles.container}>
<View style={styles.row}>
<TouchableNativeFeedback
background={TouchableNativeFeedback.SelectableBackgroundBorderless()}>
<View>
<View style={[styles.outerCircle, styles.elevation]}>
<View style={styles.innerCircle} />
</View>
</View>
</TouchableNativeFeedback>
<TouchableNativeFeedback>
<View>
<View style={[styles.outerCircle, styles.elevation]}>
<View style={styles.innerCircle} />
</View>
</View>
</TouchableNativeFeedback>
<TouchableNativeFeedback>
<View>
<View style={[styles.outerCircle, styles.elevation]}>
<View style={styles.innerCircle} />
</View>
</View>
</TouchableNativeFeedback>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: 'gray',
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
row: {
flexDirection: 'row',
margin: 5,
backgroundColor: '#fefe',
},
outerCircle: {
marginHorizontal: 5,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
height: 100,
width: 100,
borderRadius: 50,
},
elevation: {elevation: 5},
innerCircle: {
backgroundColor: 'green',
height: 80,
width: 80,
borderRadius: 40,
},
});
export default App;
Screen shots below are an extended version of the above code, but the middle circle and right circle are the same components, the left one is the borderless element that effects the adjacent circle.
I can also replicate this bug if the middle and right circles are also different elements (Views or other touchable’s) sometimes both are broken, most of the time the middle one is???
left image is RN 0.60.5, right image is 0.61.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Can confirm on 0.61.1 and I had also came to the same conclusion that using
TouchableNativeFeedback.SelectableBackgroundBorderless()is the cause. In our case it seems to be causing the elevation shadows to be displayed on top of the elevated element instead of below.Was somewhat difficult to debug with Fast Refresh turned on.
Red box is a
<TouchableNativeFeedback />withbackground={TouchableNativeFeedback.SelectableBackgroundBorderless()}Orange shape is:
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.