import * as React from "react"; import { View, StyleSheet, Pressable, ActivityIndicator, StyleProp, ViewStyle, PressableProps, Platform, } from "react-native"; import { withTheme } from "@draftbit/theme"; import type { ReadTheme } from "@draftbit/theme"; import type { IconSlot } from "../interfaces/Icon"; type Props = { disabled?: boolean; loading?: boolean; size?: number; bgColor?: string; iconColor?: string; iconName?: string; onPress: () => void; theme: ReadTheme; style?: StyleProp; } & PressableProps & IconSlot; /** * @deprecated DEPRECATED */ const FAB: React.FC> = ({ onPress, disabled, loading, iconName = "MaterialIcons/add", style, theme, iconColor, bgColor, size = 50, Icon, ...props }) => { const backgroundColor = bgColor || theme.colors.branding.primary; const color = iconColor || "#FFF"; return ( { return [ styles.button, { opacity: pressed || disabled ? 0.75 : 1, width: size, height: size, borderRadius: size / 2, backgroundColor, }, ]; }} {...props} > {loading ? ( 50 ? { marginTop: 2, marginLeft: 2 } : undefined} size={size <= 50 ? "small" : "large"} color={color} /> ) : ( )} ); }; const styles = StyleSheet.create({ button: { backgroundColor: "#5a45ff", justifyContent: "center", alignItems: "center", ...Platform.select({ web: { cursor: "pointer", userSelect: "none", }, }), }, }); export default withTheme(FAB);