热门标签 | HotTags
当前位置:  开发笔记 > 开发工具 > 正文

ReactNative的Animated.ScrollView不允许我以编程方式滚动到某个位置

如何解决《ReactNative的Animated.ScrollView不允许我以编程方式滚动到某个位置》经验,有好办法吗?

在升级到最新版本的React-Native和Expo之前,此代码块已运行。正在使用的版本是 "expo": "^32.0.0"

我以前能够以编程方式移动Animated.ScrollView的子级,但现在不再能够这样做。这是我正在测试的测试代码块。

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  Animated,
  TouchableOpacity,
  SafeAreaView,
  ScrollView
} from 'react-native';

export default class App extends React.Component {
  constructor(props) {
    super(props);
  }
  handleMove = () => {
    this.scroller.getNode().scrollTo({
      x: 200,
      y: 0,
      animated: false
    });
  };
  render() {
    return (
      
        Open up App.js to start working on your app!
         {
            this.scroller = scroller;
          }}
        >
          
        
        
          Move
        
      
    );
  }
}

const styles = StyleSheet.create({
  container: {}
});

升级后,代码块不再适用于最新版本。我正在测试的当前版本是:

"dependencies": {
    "expo": "^34.0.1",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
    "react-native-web": "^0.11.4"
  },

正确的做法是什么?

我添加了点心来说明我的问题。' https://snack.expo.io/@louis345/brave-banana


推荐阅读
author-avatar
手机用户2502937527
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有