Skip to content

Instantly share code, notes, and snippets.

@Lxxyx
Created January 20, 2017 16:21
Show Gist options
  • Save Lxxyx/3043b1120943c6abe93914727d4323a7 to your computer and use it in GitHub Desktop.
Save Lxxyx/3043b1120943c6abe93914727d4323a7 to your computer and use it in GitHub Desktop.
RN点击时,只有最里面会收到通知。
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableWithoutFeedback
} from 'react-native';
export default class touchTest extends Component {
render() {
return (
<View style={styles.container}>
<TouchableWithoutFeedback onPress={() => console.log('Other TouchableWithoutFeedback')}>
<TouchableWithoutFeedback onPress={() => console.log('Inner TouchableWithoutFeedback')}>
<View style={{
height: 100,
width: 100,
borderColor: 'blue',
borderWidth: 1
}}></View>
</TouchableWithoutFeedback>
</TouchableWithoutFeedback>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
});
AppRegistry.registerComponent('touchTest', () => touchTest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment