mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-02 14:50:43 +00:00
feat: introduce hitSlop prop (#2407)
# Summary Explain the **motivation** for making this change: here are some points to help you: * What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged * What is the feature? (if applicable) * How did you implement the solution? * What areas of the library does it impact? ## Test Plan Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. ### What's required for testing (prerequisites)? ### What are the steps to reproduce (after prerequisites)? ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | MacOS | ✅❌ | | Android | ✅ | | Web | ✅❌ |
This commit is contained in:
@@ -26,6 +26,7 @@ import Test2327 from './src/Test2327';
|
||||
import Test2233 from './src/Test2233';
|
||||
import Test2366 from './src/Test2366';
|
||||
import Test2397 from './src/Test2397';
|
||||
import Test2407 from './src/Test2407';
|
||||
|
||||
export default function App() {
|
||||
return <ColorTest />;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import React from 'react';
|
||||
import {SafeAreaView, StyleSheet} from 'react-native';
|
||||
import Svg, {Rect} from 'react-native-svg';
|
||||
|
||||
export default () => {
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
<Svg
|
||||
width={200}
|
||||
height={200}
|
||||
viewBox="0 0 200 200"
|
||||
hitSlop={50}
|
||||
// hitSlop={{top: 50, left: 50, right: 50, bottom: 50}}
|
||||
onPress={() => console.log('press')}>
|
||||
<Rect
|
||||
width={200}
|
||||
height={200}
|
||||
x={0}
|
||||
y={0}
|
||||
fill="red"
|
||||
onPress={() => console.log('rect press')}
|
||||
/>
|
||||
</Svg>
|
||||
</SafeAreaView>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user