Skip to content

Commit 182f75c

Browse files
codebutlerosdnk
authored andcommitted
fix: height changes not evaluated (#132)
I'm having intermittent issues with the bottom sheet not appearing. I tracked the issue down to the `height` field. The onLayout callback (`handleFullHeader`) is triggered with the correct dimensions and the `height` AnimatedValue is updated, but the nodes that use this value (opacity/translateY) are never re-evaluated unless something else manually triggers a re-render. This diff seems to fix the problem, although I'm not totally sure why. I did also try replacing the callback with `Animated.event()` but this does not seem to work (software-mansion/react-native-reanimated#79).
1 parent 101e634 commit 182f75c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
664664
nativeEvent: {
665665
layout: { height },
666666
},
667-
}: LayoutChangeEvent) => this.height.setValue(height)
667+
}: LayoutChangeEvent) => requestAnimationFrame(() => this.height.setValue(height))
668668

669669
private handleLayoutContent = ({
670670
nativeEvent: {

0 commit comments

Comments
 (0)