相关疑难解决方法(0)

scrollTo在动画ScrollView上未定义

Animated.createAnimatedComponent(ScrollView)用于创建动画时,ScrollView它不再可能使用scrollTo.

const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView);

<AnimatedScrollView ref={(ref) => this.list = ref}>
  <View style={{height: 1000}} />
</AnimatedScrollView>
Run Code Online (Sandbox Code Playgroud)

调用this.list.scrollTo({x: 0, y: 0})会出现以下错误:

_this.list.scrollTo is not a function

它在普通的ScrollView上运行良好.有什么方法可以解决这个问题吗?

react-native

26
推荐指数
3
解决办法
1万
查看次数

标签 统计

react-native ×1