-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMButton.js
44 lines (36 loc) · 1012 Bytes
/
MButton.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 {
View,
Text,
TouchableOpacity,
StyleSheet,
} from 'react-native';
export const MButton = props => {
if (props.isLoading) {
return (
<View {...props} style={{ ...MStyles.buttonContainer, ...props.style }} >
<ActivityIndicator size='small' color={props.color ? props.color : 'white'} />
</View>
)
}
return (
<TouchableOpacity {...props} style={{ ...MStyles.buttonContainer, ...props.style }} >
{props.title ? <Text style={{ ...MStyles.buttonText, ...props.textSyle }} >{props.title}</Text>
: props.children
}
</TouchableOpacity>
)
}
export const MStyles = StyleSheet.create({
buttonContainer: {
backgroundColor: "blue",
justifyContent: 'center',
alignItems: 'center',
height: 50,
borderRadius: 5,
},
buttonText: {
color: 'white',
textAlign: 'center'
}
})