undefined is not an object (evaluating 'scrollview.scrollResponderScrollTo')



  • ios scrollView问题求助!!
    scrollView.scrollResponderScrollTo({x:100, y:0, animated:true});
    代码就这句加上就报这个错
    0_1492678952818_WechatIMG34.jpeg



  • 您最好把报错的这段代码贴出来。



  • scrollView.scrollResponderScrollTo({x:100, y:0, animated:true});
    代码就这句加上就报这个错
    这是版本信息
    {
    "devDependencies" : {
    "babel-preset-react-native" : "1.9.1",
    "babel-jest" : "19.0.0",
    "jest" : "19.0.2",
    "react-test-renderer" : "16.0.0-alpha.6"
    },
    "jest" : {
    "preset" : "react-native"
    },
    "version" : "0.0.1",
    "scripts" : {
    "start" : "node node_modules/react-native/local-cli/cli.js start",
    "test" : "jest"
    },
    "private" : true,
    "name" : "ScrollViewDemo",
    "dependencies" : {
    "react" : "16.0.0-alpha.6",
    "react-timer-mixin" : "^0.13.3",
    "react-native" : "0.43.3"
    }
    }



  • 这样写:
    <ScrollView ref={ (component) => {this._scrollView = component} }/>

    this._scrollView.scrollTo({x:0,y:0,animated:true});


登录后回复