Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

和下拉刷新有点冲突 #7

Open
1280103995 opened this issue May 24, 2018 · 2 comments
Open

和下拉刷新有点冲突 #7

1280103995 opened this issue May 24, 2018 · 2 comments

Comments

@1280103995
Copy link

和这个RefreshControl 一起用的时候,两个都会触发

@f111fei
Copy link
Owner

f111fei commented May 24, 2018

请提供下gif截图

@1280103995
Copy link
Author

1280103995 commented May 24, 2018

gif转不了,快速下拉有水平方向偏移就会出现了。

import React,{Component} from "react";
import {Image, StyleSheet, ScrollView, View, Dimensions, RefreshControl} from "react-native";
import Carousel from 'react-native-banner-carousel';
const screenW = Dimensions.get('window').width;

export default class ThreeScreen extends Component {

constructor(props) {
super(props);
this.state = {
isRefreshing: false,
};
}

onRefresh() {
this.setState({isRefreshing: true});
setTimeout(() => {
this.setState({
isRefreshing: false,
});
}, 2000);
}

render() {
const images = [
"http://ww1.sinaimg.cn/large/0065oQSqly1frjd77dt8zj30k80q2aga.jpg",
"http://ww1.sinaimg.cn/large/0065oQSqly1frjd4var2bj30k80q0dlf.jpg",
"http://ww1.sinaimg.cn/large/0065oQSqly1frja502w5xj30k80od410.jpg"
];
return (
<ScrollView
style={styles.container}
refreshControl={
}
>

{images.map((image, index) => this.renderPage(image, index))}

  </ScrollView>
);

}

renderPage(image, index) {
return (

<Image style={{ width: screenW, height: 150 }} source={{ uri: image }} />

);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#FFFFFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants