Questions tagged [panresponder]
68 questions
0
votes
1 answer
Stale parent state in child
I have a parent component ParentItem which renders ChildItem components.
ParentItem passes removeItem() to ChildItem components during render.
Normally, anytime useState is called and the new state is different from the previous state, the component…

jjyj
- 377
- 4
- 15
0
votes
0 answers
Touching two buttons at once in React Native
I am trying to make a simple game/task that requires a user to tap the left button, the right button, or both at about the same time. However, it seems like React Native prevents two buttons from being pressed down at the same time.
import…

DingleberrySmith
- 83
- 10
0
votes
0 answers
How can I drop/hide the bottom sheet when dragged below a certain coordinate?
I have this piece of code:
onPanResponderRelease: (e, gesture) => {
if (gesture.dy > 155) {
Animated.spring(
this.state.panBottomModal,
{
toValue: { x: 0, y: 0 },
…

showtime
- 1
- 1
- 17
- 48
0
votes
0 answers
How to setState within panResponder's release event?
Inside a class component, I have a panResponder and during the onPanResponderRelease event, I want to update the state of the class component. However, the state never gets updated after the setState is called.
type ExampleState = {
duration:…

pfinferno
- 1,779
- 3
- 34
- 62
0
votes
1 answer
How to know screen idle on every component of react native?
i found example on internet:
https://snack.expo.io/Sy8ulr8B-
Main concept is to apply this code in every component:
this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => {
this.resetTimer()
return true
},
…

Maharjan
- 1
0
votes
1 answer
Is there a way to allow only the child component to use the Panresponder which is set up in the parent component?
I'm trying to find a way to allow only the child node to capture Panresponder gesture. My intention here is to make the child component move freely within the parent component. And the parent component shouldn't respond to any touches. Therefore, it…

salmanthasleem
- 15
- 6
0
votes
1 answer
Restrict panResponder from going outside the phone screen
I'm having a problem with panResponder from going outside the phone screen. I get this code from https://reactnative.dev/docs/panresponder#example. Here are some photos.
the box is able to drag/go outside the screen, how to avoid this? I…

carch
- 217
- 4
- 18
0
votes
1 answer
React-Native panResponder array with functional component
I have a slider with 6 images and I want to be able to move each one of them using panResponder.
I wrote this code (which works, but it moves all the slider, not just one image)
const pan = useState(new Animated.ValueXY())[0];
const…

Or Nakash
- 1,345
- 1
- 9
- 22
0
votes
0 answers
React Native get Touched components with PanResponder API
I'm trying to select multiple elements inside the pan component. I seacrhed a lot and now I can get the scrool coordinates, but with this x and y coordinate values I can't understand which one is selected.
HourComponent.js (so simple just one…

masterAvatarr
- 113
- 1
- 10
0
votes
1 answer
Connecting two buttons with a line in react native
I want to join two points with a line for a quiz I'm doing. I'm really new to react native and I don't really understand how to use the PanResponder (that's what I think I should use in order to get the result I expect).
I attach here the image of…

gfrancoa
- 141
- 1
- 4
0
votes
1 answer
react-native [Expo]: can I increase PanResponder's input sampling rate?
I am currently implementing a react-native-svg based drawing input for my Expo application (it is a slight modification of this answer: link). I use a PanResponder to register move events and create different paths that I then display as multiple…

marinoandrea
- 81
- 1
- 7
0
votes
1 answer
panResponder keep capturing when there is two touches on screen
I want when there are two touches on the screen panResponder to keep going and don't stop but after about half a second panResponder stops and begin to scroll
this is my code
import {View} from 'native-base';
import React, {Children, useMemo,…

Abal
- 309
- 1
- 20
0
votes
0 answers
React Native - onPress firing wrong event
I'm trying to make a rotating Rubik's cube that has each small cube as a touchable component that fires an event - Touching cubes on the Orange, Green and Yellow fire the correct events whereas touching some cubes on the other colours ends up firing…
0
votes
1 answer
React Native - Logout after 5 minutes with two screens (components)
I have an expo application and I want to implement automatic logout after 5 minutes.
In the first component that is shown when the user logs in I created:
The code below works fine but when I change to the new screen (new component) I can't renew…

Ce8
- 1
- 2
0
votes
2 answers
panResponder starts at begining position in every touch
Trying to make swiper with React Native PanResponder. When I click again to button after release button starts at begining position. I tried using setOffset in onPanResponderGrant but that makes button exceeds parent container when you scroll it. If…

Necmettin Sargın
- 87
- 1
- 10