forked from prscX/react-native-siri-wave-view
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRNSiriWaveView.js
114 lines (96 loc) · 2.53 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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 {
static propTypes = {
...ViewPropTypes,
width: PropTypes.number,
height: PropTypes.number,
size: PropTypes.object,
props: PropTypes.object,
numberOfWaves: PropTypes.number,
backgroundColor: PropTypes.string,
waveColor: PropTypes.string,
primaryWaveLineWidth: PropTypes.number,
secondaryWaveLineWidth: PropTypes.number,
frequency: PropTypes.number,
amplitude: PropTypes.number,
density: PropTypes.number,
phaseShift: PropTypes.number,
colors: PropTypes.array,
type: PropTypes.number,
startAnimation: PropTypes.bool,
stopAnimation: PropTypes.bool
}
static defaultProps = {
width: 200,
height: 100,
numberOfWaves: 5,
backgroundColor: "#FFFFFF",
waveColor: "#000000",
primaryWaveLineWidth: Platform.OS === "ios" ? 3 : 50,
secondaryWaveLineWidth: 1,
frequency: 1.5,
amplitude: 0.5,
density: 5,
phaseShift: -0.15,
intensity: 0.3,
colors: ["#2085fc", "#5efca9", "#fd4767"],
type: 0,
startAnimation: false,
stopAnimation: false
}
render() {
let {
width,
height,
numberOfWaves,
backgroundColor,
waveColor,
primaryWaveLineWidth,
secondaryWaveLineWidth,
frequency,
amplitude,
density,
phaseShift,
intensity,
colors,
type,
startAnimation,
stopAnimation
} = this.props;
let SiriWave
if (type === 0) SiriWave = SiriWaveView
else if (type === 1) SiriWave = SiriWaveView9
return <SiriWave style={{ width: width, height: height }}
size={{
width: width,
height: height
}}
numberOfWaves={numberOfWaves}
backgroundColor={backgroundColor}
waveColor={waveColor}
primaryWaveLineWidth={primaryWaveLineWidth}
secondaryWaveLineWidth={secondaryWaveLineWidth}
frequency={frequency}
amplitude={amplitude}
density={density}
phaseShift={phaseShift}
intensity={intensity}
colors={colors}
type={type}
startAnimation={startAnimation}
stopAnimation={stopAnimation}
/>;
}
}
const SiriWaveView = requireNativeComponent(
"RNSiriWaveView",
RNSiriWaveView
);
const SiriWaveView9 = requireNativeComponent(
"RNSiriWaveView9",
RNSiriWaveView
);
export default RNSiriWaveView;