Massive/MassiveFab.tsx
Brandon Presley 8461f86e88 Wrap color context with useColor custom hook
I find it easier to import hooks by useX instead of
useContext(X). Like how the navigation library is just
useNavigation
2022-10-14 17:24:02 +13:00

28 lines
591 B
TypeScript

import React from 'react';
import {FAB} from 'react-native-paper';
import {useColor} from './color';
import {lightColors} from './colors';
export default function MassiveFab(
props: Partial<React.ComponentProps<typeof FAB>>,
) {
const {color} = useColor();
const fabColor = lightColors.map(lightColor => lightColor.hex).includes(color)
? 'black'
: undefined;
return (
<FAB
icon="add"
color={fabColor}
style={{
position: 'absolute',
right: 10,
bottom: 60,
backgroundColor: color,
}}
{...props}
/>
);
}