StyledButton.js 772 Bytes
Newer Older
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
import React from 'react';
import { StyleSheet, Pressable, Text, View } from 'react-native';

const StyledButton = (props) => {
    return (
        <Pressable
            style={({ pressed }) => [
                {
                    backgroundColor: pressed ? '#437dd9' : '#4e8ff5',
                },
                style.pressableStyle,
                props.style
            ]}
            onPress={props.onPress}>
            <Text style={style.buttonText}>{props.name}</Text>
        </Pressable>
    );
};

const style = StyleSheet.create({
    pressableStyle: {
        alignItems: "center",
        justifyContent: "center",
        marginRight: 3,
        borderRadius: 2,
    },
    buttonText: {
        fontSize: 20,
    },
})

export default StyledButton