mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-01 18:15:13 +00:00
Fix pointerEvents example for View
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, Text, TouchableHighlight, View } from 'react-native';
|
import { StyleSheet, Text, Pressable, View } from 'react-native';
|
||||||
import Example from '../../shared/example';
|
import Example from '../../shared/example';
|
||||||
|
|
||||||
const log = (...msg) => {
|
const log = (...msg) => {
|
||||||
@@ -11,16 +11,15 @@ const l2 = { width: '75%', paddingLeft: 10, paddingTop: 10 };
|
|||||||
|
|
||||||
function Box({ pointerEvents }) {
|
function Box({ pointerEvents }) {
|
||||||
return (
|
return (
|
||||||
<TouchableHighlight
|
<Pressable
|
||||||
onPress={log}
|
onPress={log}
|
||||||
pointerEvents={pointerEvents}
|
pointerEvents={pointerEvents}
|
||||||
style={styles.box}
|
style={({ pressed }) => [styles.box, pressed && styles.purple]}
|
||||||
underlayColor="purple"
|
|
||||||
>
|
>
|
||||||
<TouchableHighlight onPress={log} style={styles.content} underlayColor="orange">
|
<Pressable onPress={log} style={({ pressed }) => [styles.content, pressed && styles.orange]}>
|
||||||
<Text>{pointerEvents}</Text>
|
<Text>{pointerEvents}</Text>
|
||||||
</TouchableHighlight>
|
</Pressable>
|
||||||
</TouchableHighlight>
|
</Pressable>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,13 +91,21 @@ const styles = StyleSheet.create({
|
|||||||
box: {
|
box: {
|
||||||
backgroundColor: '#ececec',
|
backgroundColor: '#ececec',
|
||||||
padding: 30,
|
padding: 30,
|
||||||
marginVertical: 5
|
marginVertical: 5,
|
||||||
|
userSelect: 'none'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
padding: 10,
|
padding: 10,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: 'black',
|
borderColor: 'black',
|
||||||
borderStyle: 'solid'
|
borderStyle: 'solid',
|
||||||
|
userSelect: 'none'
|
||||||
|
},
|
||||||
|
orange: {
|
||||||
|
backgroundColor: 'orange'
|
||||||
|
},
|
||||||
|
purple: {
|
||||||
|
backgroundColor: 'purple'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user