-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.js
37 lines (34 loc) · 1.09 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
'use strict';
const React = require('react');
const {
PropTypes,
} = React;
const ReactNative = require('react-native');
const {
View,
requireNativeComponent,
} = ReactNative;
const MarqueeLabel = React.createClass({
propTypes: {
...View.propTypes,
text : PropTypes.string.isRequired,
scrollDuration : PropTypes.number, // 秒
marqueeType : PropTypes.number, // ios
fadeLength : PropTypes.number, // ios
leadingBuffer : PropTypes.number, // ios
trailingBuffer : PropTypes.number, // ios
animationDelay : PropTypes.number, // ios
isRepeat : PropTypes.bool, // android
startPoint : PropTypes.number, // android
direction : PropTypes.number, //android
},
render: function () {
const { children, ...props } = this.props;
const nativeProps = Object.assign({}, props, { text: children });
return (
<RCTMarqueeLabel {...nativeProps} />
);
},
});
const RCTMarqueeLabel = requireNativeComponent('RCTMarqueeLabel', MarqueeLabel);
module.exports = MarqueeLabel;