import React from 'react';
import { StyleSheet, TouchableOpacity, Platform } from 'react-native';
import { ThemedText } from './themed-text';
import { Colors } from '@/constants/theme';
import { useColorScheme } from '@/hooks/use-color-scheme';
interface FabButtonProps {
onPress: () => void;
}
export function FabButton({ onPress }: FabButtonProps) {
const colorScheme = useColorScheme() ?? 'light';
const colors = Colors[colorScheme];
return (
<TouchableOpacity
style={[styles.fab, { backgroundColor: colors.tint }]}
onPress={onPress}
activeOpacity={0.8}
>
<ThemedText style={styles.fabText}>+</ThemedText>
</TouchableOpacity>
);
}
const styles = StyleSheet.create({
fab: {
position: 'absolute',
right: 20,
bottom: Platform.OS === 'ios' ? 20 : 20,
width: 56,
height: 56,
borderRadius: 28,
justifyContent: 'center',
alignItems: 'center',
elevation: 8,
shadowColor: '#000',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.3,
shadowRadius: 8,
},
fabText: {
color: '#fff',
fontSize: 32,
fontWeight: '300',
lineHeight: 32,
},
});