forked from prscX/react-native-siri-wave-view
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRNSiriWaveView.js
88 lines (74 loc) · 2.3 KB
/
RNSiriWaveView.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
85
86
87
88
import React, { Component } from "react";
import { StyleSheet, ViewPropTypes, Platform } from "react-native";
import PropTypes from "prop-types";
import { requireNativeComponent } from "react-native";
class RNSiriWaveView extends Component {
constructor(props) {
super(props)
}
render() {
return <SiriWaveView style={{ width: this.props.width, height: this.props.height }}
props={{
width: this.props.width,
height: this.props.height,
numberOfWaves: this.props.numberOfWaves,
backgroundColor: this.props.backgroundColor,
waveColor: this.props.waveColor,
primaryWaveLineWidth: this.props.primaryWaveLineWidth,
secondaryWaveLineWidth: this.props.secondaryWaveLineWidth,
frequency: this.props.frequency,
idleAmplitude: this.props.idleAmplitude,
amplitude: this.props.amplitude,
density: this.props.density,
phaseShift: this.props.phaseShift,
intensity: this.props.intensity,
colors: this.props.colors,
type: this.props.type
}}
startAnimation={this.props.startAnimation} stopAnimation={this.props.stopAnimation}
/>;
}
}
RNSiriWaveView.propTypes = {
...ViewPropTypes,
width: PropTypes.number,
height: PropTypes.number,
props: PropTypes.object,
numberOfWaves: PropTypes.number,
backgroundColor: PropTypes.string,
waveColor: PropTypes.string,
primaryWaveLineWidth: PropTypes.number,
secondaryWaveLineWidth: PropTypes.number,
frequency: PropTypes.number,
idleAmplitude: PropTypes.number,
amplitude: PropTypes.number,
density: PropTypes.number,
phaseShift: PropTypes.number,
type: PropTypes.number,
startAnimation: PropTypes.bool,
stopAnimation: PropTypes.bool
};
RNSiriWaveView.defaultProps = {
width: 200,
height: 100,
numberOfWaves: 5,
backgroundColor: "#FFFFFF",
waveColor: "#000000",
primaryWaveLineWidth: Platform.OS === "ios" ? 3 : 50,
secondaryWaveLineWidth: 1,
frequency: 1.5,
idleAmplitude: 0.01,
amplitude: 0.01,
density: 5,
phaseShift: -0.15,
intensity: 0.3,
colors: ["#2085fc", "#5efca9", "#fd4767"],
type: 0,
startAnimation: false,
stopAnimation: false
};
const SiriWaveView = requireNativeComponent(
"RNSiriWaveView",
RNSiriWaveView
);
export default RNSiriWaveView;