mirror of
https://github.com/morten-olsen/react-native-debug-console.git
synced 2026-02-08 00:36:26 +01:00
31 lines
555 B
JavaScript
31 lines
555 B
JavaScript
import React from 'react';
|
|
import styled from 'styled-components/native';
|
|
import Icon from '../Icon';
|
|
import {
|
|
Body,
|
|
} from '../text';
|
|
|
|
const Item = styled.TouchableOpacity`
|
|
padding: 10px 10px;
|
|
opacity: ${({ disabled }) => disabled ? 0.3 : 1};
|
|
`;
|
|
|
|
const Button = ({
|
|
name,
|
|
icon,
|
|
onPress,
|
|
disabled,
|
|
}) => (
|
|
<Item
|
|
onPress={disabled ? undefined : onPress}
|
|
disabled={disabled}
|
|
>
|
|
{icon ? (
|
|
<Icon name={icon} />
|
|
) : (
|
|
<Body color={disabled ? '#ccc' : undefined}>{name}</Body>
|
|
)}
|
|
</Item>
|
|
);
|
|
|
|
export default Button; |