nysamnang / react-native-raw-bottom-sheet

Add Your Own Component To Bottom Sheet Whatever You Want (Android and iOS)
https://npmjs.com/package/react-native-raw-bottom-sheet
MIT License
1.08k stars 192 forks source link

Error: Style property 'height' is not supported by native animated module #185

Open abba-danmusa opened 4 months ago

abba-danmusa commented 4 months ago

I get the above error every time I try to use react-native-raw-bottom-sheet.

LeslieOA commented 4 months ago

I get the above error every time I try to use react-native-raw-bottom-sheet.

You can use useNativeDriver={false}, but it would be great to figure out which animations/transitions trigger this in the module.

<RBSheet
  ref={refRBSheet}
  useNativeDriver={false}
>
  ...
</RBSheet>
nelson-david commented 4 months ago

I've been facing this same issue for days. I had to make peace with the fact I wasn't going to use "useNativeDriver".

Well, after seeing the issue you opened, I decided to actually find a fix for it and I did. I've created a pull request and hopefully it will get merged by @nysamnang.

But here's what you can do for now.

Open the package "react-native-raw-bottom-sheet" in your node_modules folder and navigate to "src/index.js" You will see this portion of code

<Animated.View testID="AnimatedView" {...(dragOnContent && panResponder.panHandlers)} // Attach pan handlers to content if dragOnContent is true style={[ styles.container, {transform: pan.getTranslateTransform()}, {height: animatedHeight}, customStyles.container, ]}> {draggable && ( // Show draggable icon if set it to true <View testID="DraggableView" {...(!dragOnContent && panResponder.panHandlers)} // Attach pan handlers to draggable icon if dragOnContent is false style={styles.draggableContainer}> <View testID="DraggableIcon" style={[styles.draggableIcon, customStyles.draggableIcon]} /> </View> )} {children} </Animated.View>

replace it with

<Animated.View testID="AnimatedView" {...(dragOnContent && panResponder.panHandlers)} // Attach pan handlers to content if dragOnContent is true style={[ styles.container, {transform: pan.getTranslateTransform()}, {height: useNativeDriver?height:animatedHeight}, customStyles.container, ]}> {draggable && ( // Show draggable icon if set it to true <View testID="DraggableView" {...(!dragOnContent && panResponder.panHandlers)} // Attach pan handlers to draggable icon if dragOnContent is false style={styles.draggableContainer}> <View testID="DraggableIcon" style={[styles.draggableIcon, customStyles.draggableIcon]} /> </View> )} {children} </Animated.View>

abba-danmusa commented 4 months ago

Oh, Thank you, @nelson-david, but I've already moved on to use '@gorhom/bottom-sheet', and it works perfectly.

Nevertheless, thank you so much, indeed, I will try that next time.

zulfio commented 4 months ago

Oh, Thank you, @nelson-david, but I've already moved on to use '@gorhom/bottom-sheet', and it works perfectly.

Nevertheless, thank you so much, indeed, I will try that next time.

Well just remember, @gorhom/bottom-sheet is using reanimated and it's will make your app size bigger

Raduc4 commented 3 months ago

Any solution here?

hoanglq commented 3 months ago

Cause: because you haven't set the height in the tag. my example:

<RBSheet ...>
      <View style={{ height: '100%', width: '100%', backgroundColor: '#000', justifyContent: 'center', alignItems: 'center' }}>
                    <Text style={{ color: '#fff' }}>Hello</Text>
       </View>
</RBSheet>