Repository navigation
Closed
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Bug
I try to use pointerEvents={'none'} on Image component, but it does not work on Android. It is effective on iOS.
React Native version:
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
Memory: 141.91 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.1.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 24, 26, 27, 28
Build Tools: 26.0.2, 27.0.3, 28.0.2, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-27 | Intel x86 Atom_64, android-28 | Intel x86 Atom_64
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Steps To Reproduce
export default class GeneralBackground extends PureComponent {
render() {
return (
<View style={styles.container}>
{this.props.children}
<Image
source={myImage}
style={styles.image}
pointerEvents={'none'} // Does not work on Android.
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.theme
},
image: {
width: 160,
resizeMode: 'stretch',
alignSelf: 'center',
position: 'absolute'
}
});
I expect that this.props.children like Button component can be work but not Image above. But it can work on iOS via testing, Android failed. Did I use it by mistake? I think it maybe a bug.
Anybody knows that? Thanks a lot in advance.
Metadata
Metadata
Assignees
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Activity
RobinCsl commentedon Jul 14, 2019
Hi @Amos729,
It seems that the
pointerEventsprop is not available on theImagecomponent: searchingpointerEventson https://facebook.github.io/react-native/docs/image yielded nothing.I believe it's only available for
Viewcomponents: https://facebook.github.io/react-native/docs/view#pointereventsDoing something like that
made a children
Buttonclickable on Android.Hope that helps!
arlovip commentedon Jul 14, 2019
@RobinCsl I tried what you said just now. It's really useful both Android and iOS platform.
Thank you so much.
jjercx commentedon Mar 11, 2021
For the record, same problem with
TextInputbut also solved with a wrapping view withpointerEvents={'none'}