-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
index.js
executable file
·48 lines (44 loc) · 1.19 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
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { requireNativeComponent } from 'react-native';
export default class Shimmer extends Component {
static propTypes = {
animating: PropTypes.bool,
direction: PropTypes.oneOf(['up', 'down', 'left', 'right']),
duration: PropTypes.number,
pauseDuration: PropTypes.number,
animationOpacity: PropTypes.number,
opacity: PropTypes.number,
tilt: PropTypes.number,
intensity: PropTypes.number,
highlightLength: PropTypes.number,
beginFadeDuration: PropTypes.number,
endFadeDuration: PropTypes.number,
};
static defaultProps = {
animating: true,
animationOpacity: 1,
duration: 1000,
opacity: 0.5,
tilt: 0,
pauseDuration: 400,
beginFadeDuration: 0,
endFadeDuration: 0,
};
render() {
const { direction, opacity, ...props } = this.props;
return (
<RNShimmeringView
shimmeringOpacity={opacity}
shimmeringDirection={direction}
{...props}
/>
);
}
}
const RNShimmeringView = requireNativeComponent('RNShimmeringView', Shimmer, {
nativeOnly: {
shimmeringDirection: true,
shimmeringOpacity: true,
},
});