Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 1x 10x 10x | import React from 'react';
import { NavBarNativeProps } from './NavBar.native.types';
import { View } from 'react-native';
import { cn } from '@sb/libs';
const variantStyles = {
primary: 'bg-tertiary text-text-main',
secondary: 'bg-secondary text-text-main',
transparent: 'bg-transparent text-text-main',
};
export const NavBar: React.FC<NavBarNativeProps> = ({
id,
variant = 'primary',
shadowOnScroll,
position,
className,
children,
}) => {
const positionClasses = cn({
'sticky top-0': position === 'sticky',
'absolute top-0 left-0 right-0': position === 'absolute',
relative: position === 'relative',
'fixed top-0 right-0 left-0': position === 'fixed',
});
return (
<View
id={id}
testID={id}
accessibilityRole="header"
style={{ height: 54 }}
className={cn(
'w-full justify-center',
variantStyles[variant],
positionClasses,
{ 'shadow-md transition-shadow duration-300': shadowOnScroll },
className
)}
>
{children}
</View>
);
};
|