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

Pan Gesture event #998

Closed
Livijn opened this issue Jun 18, 2022 · 16 comments · May be fixed by #1796
Closed

Pan Gesture event #998

Livijn opened this issue Jun 18, 2022 · 16 comments · May be fixed by #1796
Labels
enhancement New feature or request no-issue-activity

Comments

@Livijn
Copy link

Livijn commented Jun 18, 2022

Feature Request

Why it is needed

This might be a feature request, or perhaps it's already available. I am trying to respond to the pan gesture. Basically, when the sheet is panned larger/smaller, I want another item to shrink / expand.

I've looked at the gestureEventsHandlersHook prop and this hook with no luck:

export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =

Is there a way to do this atm?

Possible implementation

Perhaps a onPanStart and onPanEnd event.

Code sample

No idea

@Livijn Livijn added the enhancement New feature or request label Jun 18, 2022
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@Livijn
Copy link
Author

Livijn commented Jul 19, 2022

bump

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@Livijn
Copy link
Author

Livijn commented Aug 21, 2022

bump

@Marbos21
Copy link

Marbos21 commented Sep 8, 2022

Any news?

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@g-m-99
Copy link

g-m-99 commented Aug 8, 2023

Why this request has been closed? This feature can be very useful to someone ho need to perform an action when the bottom sheet is dragged

@w4t3r-45
Copy link

w4t3r-45 commented Oct 3, 2023

any luck ?

@bewallyt
Copy link

I ended up creating a local copy of useCustomerGestureEventsHandlers, making modifications to it, and then passing it in as a prop: gestureEventsHandlersHook={useCustomGestureEventsHandlers}

@AndreiTimofte96
Copy link

AndreiTimofte96 commented Apr 24, 2024

Hi, @bewallyt! Could you help me with an example of how to use useCustomerGestureEventsHandlers ? I copied it from https://github.com/gorhom/react-native-bottom-sheet/blob/master/example/app/src/screens/advanced/customGestureHandling/useCustomGestureEventsHandlers.ts modified it to accept an onStart prop and I'm trying to use it like:

 <BottomSheet
 ...
     gestureEventsHandlersHook={useCustomGestureEventsHandlers({
       onStart: () => { console.log("ON START") },
      })}
      ...

Result: not working, the app crashes and closes automatically. I'm missing something...

How can I know when the handleOnStart drag event triggered ?

@bewallyt
Copy link

@AndreiTimofte96

does it make sense to just modify the built in handleOnStart (i.e., add a log statement) before trying to add an additional onStart prop?

@AndreiTimofte96
Copy link

AndreiTimofte96 commented Apr 25, 2024

@bewallyt adding a log statement isn't enough for my use case. I need to have acces from outside of that hook. My use case is that I want to control the content displayed inside the BottomSheet. So I would need to pass (somehow) an onDragStart callback to the BottomSheet.

 const [content, setContent] = useState("before drag content");

  return (
    <BottomSheet
      gestureEventsHandlersHook={useCustomGestureEventsHandlers({
      onStart: () => {setContent("after drag content")},
      })}
      ref={bottomSheetRef}
      snapPoints={[
        bottomSheetHeightRef.current,
        bottomSheetHeightRef.current + 5,
        '90%',
      ]}
    >
      <BottomSheetView style={styles.bottomSheet}>
        {content}
        </BottomSheetView>
        ........

Any help would be highly appreciated! Thank you!

@bewallyt
Copy link

can i see how onStart is implemented in your useCustomGestureEventsHandlers?

@AndreiTimofte96
Copy link

@bewallyt

image

@bewallyt
Copy link

maybe try invoking on start when it meets some threshold of translation y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no-issue-activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants