This repository has been archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
RNIconic.js
84 lines (75 loc) · 1.97 KB
/
RNIconic.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
import React, { Component } from "react";
import { StyleSheet, ViewPropTypes, Platform } from "react-native";
import PropTypes from "prop-types";
import { requireNativeComponent } from "react-native";
class RNIconic extends Component {
static Shapes = {
Default: "default",
Add: "add",
Minus: "minus",
Close: "close",
Back: "back",
Forward: "forward",
Menu: "menu",
Download: "download",
Share: "share",
DownBasic: "down-basic",
UpBasic: "up-basic",
Paused: "paused",
DownArrow: "down-arrow",
RightTriangle: "right-triangle",
LeftTriangle: "left-triangle",
UpTriangle: "up-triangle",
DownTriangle: "down-triangle",
Ok: "ok",
Rewind: "rewind",
FastForward: "fast-forward",
Square: "square",
BURGER: "BURGER",
ARROW: "ARROW",
X: "X",
CHECK: "CHECK"
};
static propTypes = {
...ViewPropTypes,
size: PropTypes.number,
rounded: PropTypes.bool,
tintColor: PropTypes.string,
lineThickness: PropTypes.number,
color: PropTypes.string,
shape: PropTypes.array || PropTypes.string,
disable: PropTypes.bool,
selection: PropTypes.number,
onChange: PropTypes.func
};
static defaultProps = {
size: 100,
selection: 0,
disabled: false,
backgroundColor: "#FFFFFF"
};
_onChange = event => {
this.props.onChange && this.props.onChange(event.nativeEvent.value);
};
render() {
return (
<IconicButton
ref={ref => {
this._iconicButton = ref;
}}
style={{ width: this.props.size, height: this.props.size }}
tintColor={this.props.tintColor}
size={this.props.size}
disable={this.props.disabled}
shape={this.props.shape}
color={this.props.color}
selection={this.props.selection}
onChange={this._onChange}
/>
);
}
}
const IconicButton = requireNativeComponent("RNIconic", RNIconic, {
nativeOnly: { onChange: true }
});
export default RNIconic;