-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
42 lines (34 loc) · 908 Bytes
/
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
import React from 'react';
import { requireNativeComponent, processColor } from 'react-native';
import PropTypes from 'prop-types';
class ColorPanel extends React.Component {
_onColorChange = (event) => {
if (!this.props.onColorChange) {
return;
}
this.props.onColorChange(event.nativeEvent.color);
}
render() {
return (
<RNColorPanel
{...this.props}
color={processColor(this.props.color)}
onColorChange={this._onColorChange}
/>
);
}
}
ColorPanel.propTypes = {
fullColor: PropTypes.bool,
color: PropTypes.string,
brightnessLowerLimit: PropTypes.number,
onColorChange: PropTypes.func,
};
ColorPanel.defaultProps = {
fullColor: true,
color: 'rgba(255, 0, 0, 1)',
brightnessLowerLimit: 0,
onColorChange: undefined
};
const RNColorPanel = requireNativeComponent('RNColorPanel', ColorPanel);
export default ColorPanel;