Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to get swiped over element? #1455

Closed
kamil-sobczyk opened this issue Sep 16, 2020 · 2 comments
Closed

Is there a way to get swiped over element? #1455

kamil-sobczyk opened this issue Sep 16, 2020 · 2 comments
Labels

Comments

@kamil-sobczyk
Copy link

kamil-sobczyk commented Sep 16, 2020

Simplified code:

const onPointSwipe = (i: number) => {
console.log("i", i);
};

          <Rect
            x={0}
            y={0}
            width="50%"
            height="50%"
            fill="white"
            strokeWidth="3"
            stroke="black"
            onPressIn={() => onPointSwipe(0)}
            onPress={() => console.log("press")}
            onPressOut={() => console.log("press out")}
            delayPressIn={2}
          />
          <Rect
            x={"50%"}
            y={0}
            width="50%"
            height="50%"
            fill="white"
            strokeWidth="3"
            stroke="black"
            onPressIn={() => onPointSwipe(1)}
            onPress={() => console.log("press")}
            onPressOut={() => console.log("press out")}
          />
          <Rect
            x={0}
            y={"50%"}
            width="50%"
            height="50%"
            fill="white"
            strokeWidth="3"
            stroke="black"
            onPressIn={() => onPointSwipe(2)}
            onPress={() => console.log("press")}
            onPressOut={() => console.log("press out")}
          />
          <Rect
            x={"50%"}
            y={"50%"}
            width="50%"
            height="50%"
            fill="white"
            strokeWidth="3"
            stroke="black"
            onPressIn={() => onPointSwipe(3)}
            onPress={() => console.log("press")}
            onPressOut={() => console.log("press out")}
          />

        </Svg>

This is the square container SVG with 4 smaller squares inside. I need indicate which small square is swiped over and color it for example.
Now onPressIn works only ones and is not triggered when swipe on another square. It is triggered again when finger is back on that one square.
Is it possible to achieve?

@kamil-sobczyk
Copy link
Author

Any update on this?

@bohdanprog bohdanprog added the bug label Jun 26, 2024
@jakex7 jakex7 added Question and removed bug labels Dec 19, 2024
@jakex7
Copy link
Member

jakex7 commented Dec 19, 2024

react-native-svg supports only basic gestures. For more advanced ones like swipe, pinch, or fling, I recommend using the react-native-gesture-handler library. You can find more details in its documentation: https://docs.swmansion.com/react-native-gesture-handler/

Feel free to reach out if you have any questions about integrating these two libraries. I'll try to help!

@jakex7 jakex7 closed this as completed Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants