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

Auto snap to dynamic content sections #1024

Open
AnatoleLucet opened this issue Jul 7, 2022 · 36 comments
Open

Auto snap to dynamic content sections #1024

AnatoleLucet opened this issue Jul 7, 2022 · 36 comments
Assignees
Labels
enhancement New feature or request v5

Comments

@AnatoleLucet
Copy link

Feature Request

It'd be nice to have a way to automatically snap to content sections.

image

Not sure if there's a way to do this currently (if there's, I'd be glad to know how 🙂)

Why it is needed

Let's take Google Map's bottom sheet as an example:

image

By default, this bottom sheet snaps to a preview view (the one we can see on the screenshot) that can be extended to show more info.
While it could be possible to hard code the preview view's snap point, it'd be way better to be able to do this dynamically.

Possible implementation

Sorry, I don't know enough about this lib or React Native in general to advocate anything.

Code sample

Maybe:

const App = () => {
  const {
    animatedHandleHeight,
    animatedSnapPoints,
    animatedContentHeight,
    handleContentLayout,
  } = useBottomSheetDynamicSectionsSnapPoints();

  return (
    <BottomSheet
      snapPoints={animatedSnapPoints}
      handleHeight={animatedHandleHeight}
      contentHeight={animatedContentHeight}
    >
      <BottomSheetView
        style={contentContainerStyle}
        onLayout={handleContentLayout(0)} // might be easier if we give the index of the section
      >
        //... section 1
      </BottomSheetView>

      <BottomSheetView
        style={contentContainerStyle}
        onLayout={handleContentLayout(1)}
      >
        //... section 2
      </BottomSheetView>
    </BottomSheet>
  );
};
@AnatoleLucet AnatoleLucet added the enhancement New feature or request label Jul 7, 2022
@github-actions
Copy link

github-actions bot commented Aug 7, 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.

@AnatoleLucet
Copy link
Author

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

github-actions bot commented Sep 8, 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.

@AnatoleLucet
Copy link
Author

@github-actions on the edge of making a bot to auto reply to you

@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.

@AnatoleLucet
Copy link
Author

@github-actions

@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.

@AnatoleLucet
Copy link
Author

@github-actions

@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.

@AnatoleLucet
Copy link
Author

@github-actions

@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.

@andrecrimb
Copy link

👍🏽

@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.

@AnatoleLucet
Copy link
Author

AnatoleLucet commented Feb 14, 2023

@github-actions 👋 long time no see

@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.

@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.

@andrecrimb
Copy link

👍🏽

@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.

@AnatoleLucet
Copy link
Author

👋 @github-actions

@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.

@AnatoleLucet
Copy link
Author

@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.

@AnatoleLucet
Copy link
Author

👋

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.

@AnatoleLucet
Copy link
Author

🥲

Copy link

github-actions bot commented Jan 2, 2024

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.

Copy link

github-actions bot commented Jan 7, 2024

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

@github-actions github-actions bot closed this as completed Jan 7, 2024
@gorhom gorhom self-assigned this Jan 8, 2024
@gorhom
Copy link
Owner

gorhom commented Jan 8, 2024

seems like a good feature to add 🧐 , let me look into it

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

No branches or pull requests

4 participants