【发布时间】:2020-02-15 17:46:05
【问题描述】:
我一直在努力:
<Animated.View
style={[{
height: this.collapse.interpolate({
inputRange: [0, 1],
outputRange: ['0%', '100%'],
}),
}]}
>
{children}
</Animated.View>
但列表中的一项采用FlatList 的总高度。
我尝试使用minHeight,但同样的问题。
如何将动画高度设为 100%?
复制
小吃:https://snack.expo.io/@kopax/petrified-cookies
在浏览器中,高度不是<FlatList />的高度,但在本机上,它看起来像这样:
如何为这个动画使用动态高度?
【问题讨论】:
-
你能分享到snack吗?
-
我刚刚用小吃复制品更新了我的答案。
-
请注意,您可以在动画视图的父级上设置
childrenContainerStyle和containerStyled,请参阅:github.com/software-mansion/react-native-gesture-handler/blob/…。我还发现maxHeight和minHeight在 react native 中不能很好地配合使用。到目前为止,我已经尝试过使用可用的 css,例如flex或minHeight,maxHeight,height,但还没有找到一种实现动态高度的方法。 -
@OliverD 有问题吗?
-
很遗憾,不,检查@needsleep 答案:)
标签: javascript react-native expo react-animated react-native-web