Skip to content

Instantly share code, notes, and snippets.

@Klerith
Last active October 17, 2024 20:58
Show Gist options
  • Save Klerith/a84d9e8ed7ab4a3c5510c01cc78970b6 to your computer and use it in GitHub Desktop.
Save Klerith/a84d9e8ed7ab4a3c5510c01cc78970b6 to your computer and use it in GitHub Desktop.
Botón flotante
import { Ionicons } from '@expo/vector-icons';
import { StyleProp, ViewStyle, TouchableOpacity } from 'react-native';
interface Props {
iconName: keyof typeof Ionicons.glyphMap;
onPress: () => void;
style?: StyleProp<ViewStyle>;
}
export const FAB = ({ style, iconName, onPress }: Props) => {
return (
<TouchableOpacity
style={[
{
position: 'absolute',
bottom: 30,
right: 20,
width: 60,
height: 60,
shadowColor: 'black',
backgroundColor: 'black',
shadowOffset: {
width: 0,
height: 10,
},
shadowOpacity: 0.4,
shadowRadius: 10,
elevation: 3,
borderRadius: 13,
alignItems: 'center',
justifyContent: 'center',
},
style,
]}
onPress={onPress}
>
<Ionicons name={iconName} size={30} color="white" />
</TouchableOpacity>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment