-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathButton.tsx
More file actions
33 lines (29 loc) · 800 Bytes
/
Button.tsx
File metadata and controls
33 lines (29 loc) · 800 Bytes
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
import React, {ReactHTMLElement} from "react";
import { StyleSheet, TouchableOpacity, View, ViewStyle } from "react-native";
import {palette} from "../constants/colors";
interface IStyle {
container: ViewStyle,
}
const styles = StyleSheet.create<IStyle>({
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderColor: 'red',
}
});
interface IProps {
style?: ViewStyle,
color?: string,
children?: React.ReactChild,
onPress: () => void,
}
export const Button = (props: IProps) =>
<TouchableOpacity
style={[styles.container, props.style, {backgroundColor: props.color || palette.accentColor}]}
onPress={props.onPress}>
<View style={styles.container}>
{props.children}
</View>
</TouchableOpacity>;