μ΄λ―Έμ§ κ΅¬μ± μμμ pointerEvents={'none'}
μ μ¬μ©νλ €κ³ νλλ° Androidμμλ μλνμ§ μμ΅λλ€. iOSμμ ν¨κ³Όμ μ
λλ€.
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
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'
}
});
this.props.children
like Button κ΅¬μ± μμ λ μλ ν μ μμ§λ§ μμ μ΄λ―Έμ§λ μλνμ§ μμ κ²μΌλ‘ μμν©λλ€. κ·Έλ¬λ ν
μ€νΈλ₯Ό ν΅ν΄ iOSμμ μλ ν μ μμ§λ§ Androidλ μ€ν¨νμ΅λλ€. μ€μλ‘ μ¬μ© νμ΅λκΉ? μλ§ λ²κ·ΈλΌκ³ μκ°ν©λλ€.
μλ μ¬λ μλμ? λ§μ κ°μ¬λ립λλ€.
μλ νμΈμ @ Amos729 ,
pointerEvents
μνμ Image
κ΅¬μ± μμμμ μ¬μ©ν μμλ κ² κ°μ΅λλ€ : https://facebook.github.io/react-native/docs/image μμ pointerEvents
νλ©΄ μ°μΆ λ¨ μ무κ²λ.
View
κ΅¬μ± μμμλ§ μ¬μ©ν μ μλ€κ³ μκ°ν©λλ€ : https://facebook.github.io/react-native/docs/view#pointerevents
κ·Έλ° μμΌλ‘
<View style={styles2.image} pointerEvents={'none'}>
<Image source={myImage} />
</View>
Androidμμ μ΄λ¦°μ΄ Button
ν΄λ¦ ν μ μλλ‘νμ΅λλ€.
λμμ΄ λμκΈ°λ₯Ό λ°λλλ€.
@RobinCsl λ°©κΈ λΉμ μ΄ λ§ν κ²μ μλνμ΅λλ€. Android λ° iOS νλ«νΌ λͺ¨λμμ μ λ§ μ μ©ν©λλ€.
μ λ§ κ³ λ§μ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
μλ νμΈμ @ Amos729 ,
pointerEvents
μνμImage
κ΅¬μ± μμμμ μ¬μ©ν μμλ κ² κ°μ΅λλ€ : https://facebook.github.io/react-native/docs/image μμpointerEvents
νλ©΄ μ°μΆ λ¨ μ무κ²λ.View
κ΅¬μ± μμμλ§ μ¬μ©ν μ μλ€κ³ μκ°ν©λλ€ : https://facebook.github.io/react-native/docs/view#pointereventsκ·Έλ° μμΌλ‘
Androidμμ μ΄λ¦°μ΄
Button
ν΄λ¦ ν μ μλλ‘νμ΅λλ€.λμμ΄ λμκΈ°λ₯Ό λ°λλλ€.