|
@@ -0,0 +1,44 @@
|
|
1
|
+/* @flow */
|
|
2
|
+
|
|
3
|
+import React, { Component } from 'react';
|
|
4
|
+import { Text, TouchableOpacity } from 'react-native';
|
|
5
|
+
|
|
6
|
+type Props = {
|
|
7
|
+
|
|
8
|
+ /**
|
|
9
|
+ * React Elements to display within the component.
|
|
10
|
+ */
|
|
11
|
+ children: React$Node | Object,
|
|
12
|
+
|
|
13
|
+ /**
|
|
14
|
+ * Handler called when the user presses the button.
|
|
15
|
+ */
|
|
16
|
+ onValueChange: Function,
|
|
17
|
+
|
|
18
|
+ /**
|
|
19
|
+ * The component's external style.
|
|
20
|
+ */
|
|
21
|
+ style: Object
|
|
22
|
+};
|
|
23
|
+
|
|
24
|
+/**
|
|
25
|
+ * Renders a button.
|
|
26
|
+ */
|
|
27
|
+export default class ButtonImpl extends Component<Props> {
|
|
28
|
+ /**
|
|
29
|
+ * Implements React's {@link Component#render()}, renders the button.
|
|
30
|
+ *
|
|
31
|
+ * @inheritdoc
|
|
32
|
+ * @returns {ReactElement}
|
|
33
|
+ */
|
|
34
|
+ render() {
|
|
35
|
+ return (
|
|
36
|
+ <TouchableOpacity
|
|
37
|
+ onPress = { this.props.onValueChange } >
|
|
38
|
+ <Text style = { this.props.style }>
|
|
39
|
+ { this.props.children }
|
|
40
|
+ </Text>
|
|
41
|
+ </TouchableOpacity>
|
|
42
|
+ );
|
|
43
|
+ }
|
|
44
|
+}
|