import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View, ScrollView, RefeshControl } from 'react-native'; /* * ScrollView的简单实现 * 实现监测拖拽 ,滑动的相关方法 * * 1.添加几个子组件(3个) * * 2.实现相关方法,并赋给ScrollView * 3.下拉刷新 refreshControl 菊花 * */ var MyScrollView = React.createClass({ _onScrollBeginDrag:function () { console.log("开始拖拽") }, _onScrollEndDrag:function () { console.log("结束拖拽") }, _onMomentumScrollBegin:function () { console.log("开始滑动") }, _onMomentumScrollEnd:function () { console.log("滑动结束") }, _onRefresh:function () { console.log("刷新"); }, render:function () { return( } > ); } }); var styles = StyleSheet.create({ container:{ flex:1, backgroundColor:"cyan" }, scrollView:{ marginTop:25, backgroundColor:"#CCCCCC" }, view_1:{ margin:15, flex:1, height:300, backgroundColor:"yellow" }, view_2:{ margin:15, flex:1, height:300, backgroundColor:"blue" }, view_3:{ margin:15, flex:1, height:300, backgroundColor:"green" }, });