-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
84 lines (75 loc) · 5.23 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @回到顶部
*/
'use strict';
import React, { Component } from 'react';
import {
View,
Text,
Image,
StyleSheet,
TouchableOpacity,
Dimensions
} from 'react-native';
let backToTopImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAQAAAC3FX0qAAAJNElEQVR4Ae2cfUxb1xnGz9oNjG2M+XQ+2qrSqjVKp6QN2bIsTN3yx/6YplWdtmTtpKZpt7WMVI3abhULWhuirJ0irZvaKmwdSrMomRjZaALtKN8QMOCvez2tKc7HWj78AqbAEpsABXzX6zc9V1dnR5btU3wtcd9/DJYwP57nfc65l3MOWbviX59j6hYs9h1DczAAt/KLATQoiobx+Vh9gVP4LkUzFpYeRYPIilU2W/iOBqfHMh5K1k5z05beH7oOeWp8jVKf/J582Q/+Yfl9aVDq8DV6alxV3XvObd1uQTgDYDEwiJK1Ibtl2+Azvnr5cgCGYRJmIQILsAQroEAUlmER5iECszAJwxAA+bKvvv/ZxtLiHNQMsdIExcI0fMn1vDRwCcYhHAOIXysQhnG4BNLAQOWZTUTFYqBWUxsK811z716p0R+cgEVQkqhFmAB/0NfU/XBZLjFpUKulkw5mv7X/UWlgGCKgpFhzMALSwIX938ljoVbJaFtNfY/IvlG4AYqgugGjIEkX9t1pRSjx5uNrk9W2XWoVBMNA+doavkZ7SrxOLM5ei/sF/8i0aBha0+AfGajebSMm0UgMjurts3dJzUE2yYTWCgTB11KL2af2E0USbrWe78lDIVBWoUIgD7U8SMzidGJwNmS7Kv3B66CsUl2HD8BZZbeKRaI49+d4Xh+DJVBWsZ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DppUIU5Jce/0V7pamAPWUGAJVjQHbLiamj71e+/aVJR1J6hMHptxOPwddJD5ZF8FYsUO9b9bte5fR1H+mpd73id0kX5qh/8IF+VLnqdrnf6ajuO/GP/sbKS9URDySd5ehjR2sRBYqBU+1kRS1UrBlZEiklJrBxaqV/HMIpiIKoqiGJVbSbgkBUR5qM9ZaZYCGaPaYZ4WPhVPrEjCEUx84/BSeNBRTEskwaGaEwhhgZi4h1UZJSjpBBLBVPR1LJohd+JvWdClMw4IYsqxinxh30Z/zi2tQPz1o40XLvWLiHX/wAK1chMLzoTvQAAAABJRU5ErkJggg==';
export default class ScrollToTop extends Component {
render() {
let config = this.props;
return (
<TouchableOpacity
onPress={this._onPress.bind(this)}
style={[styles.toTop, {
borderRadius: config.isRadius? config.bdRadius : 0,
backgroundColor: config.bgColor?config.bgColor:config.text?'#099fde':null,
width: config.width,
height: config.height,
left: config.left,
top: config.top
}]}>
{config.text?
<Text
style={{
color: config.color,
fontSize: config.fontSize
}}>
{config.text}
</Text>
:
<Image
style={{
width: config.width,
height: config.height
}}
source={{
uri: config.imageUri
}} />
}
</TouchableOpacity>
);
}
_onPress() {
/*
* android,ios都使用原生下拉刷新组件:
*/
this.props.root.refs.listview.scrollTo({x:0, y:0, animated:true});
}
}
ScrollToTop.defaultProps = {
isRadius: true,
width: 60,
height: 60,
left: Dimensions.get('window').width - 80,
top: Dimensions.get('window').height - 160,
bdRadius: 30,
color: '#ffffff',
fontSize: 12,
imageUri: backToTopImage
}
let styles = StyleSheet.create({
toTop: {
flex: 1,
position: 'absolute',
alignItems: 'center',
justifyContent: 'center',
},
})