Coder Social home page Coder Social logo

Comments (5)

njdancer avatar njdancer commented on July 28, 2024 12

As a workaround you can set the key to a value changes with the snapPoints. This will force a re-render.

For example:

const BottomSheetContainer = ({ snapPointHeight }) => {
  return (
    <BottomSheet
      key={snapPointHeight}
      renderContent={() => <BottomSheetContent />}
      renderHeader={() => <BottomSheetHeader />}
      snapPoints={[snapPointHeight, 400]}
    />
  )
}

from react-native-reanimated-bottom-sheet.

EricPKerr avatar EricPKerr commented on July 28, 2024 5

@osdnk is there a recommended way to do this? Seems like dynamic snapPoint support would be an awesome addition to this

from react-native-reanimated-bottom-sheet.

rvssvl avatar rvssvl commented on July 28, 2024

@EricPKerr @osdnk In my project I don't know in advance the height of the content which is passed to BottomSheet's renderContent, is it possible to snap by percentage of the 'contentHeight' not the 'screenHeight'?

from react-native-reanimated-bottom-sheet.

Daavidaviid avatar Daavidaviid commented on July 28, 2024

As a workaround you can set the key to a value changes with the snapPoints. This will force a re-render.

For example:

const BottomSheetContainer = ({ snapPointHeight }) => {
  return (
    <BottomSheet
      key={snapPointHeight}
      renderContent={() => <BottomSheetContent />}
      renderHeader={() => <BottomSheetHeader />}
      snapPoints={[snapPointHeight, 400]}
    />
  )
}

When I set the key, the app just freezes

from react-native-reanimated-bottom-sheet.

und3f1n3d avatar und3f1n3d commented on July 28, 2024

I actually look forward to this update. My issue is when device orientation changes, let say i have snapPoinst is like this: ['70%', '45%, '25%']. When it was initialized at Portrait mode, snap points are correctly calculated. However, once rotate to landscape mode, you can see the snap points are no longer going to the right places even when i am not having a dynamic snapPoint and only using a static % values. When i said right places, means that the alignments are different between initialized at Portrait mode first and rotate vs. initialized at Landscape mode first and rotate. Because of this, the sheet often went overboard and I can't close it because I have a header as well. :(

So then i tried to solve it with dynamic snapPoints, yet, no luck. So I would appreciate if the next update has this fix. It's a great component so far! 👍

from react-native-reanimated-bottom-sheet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.