forked from mrzachnugent/react-native-reusables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
label.tsx
33 lines (29 loc) · 912 Bytes
/
label.tsx
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
import React from 'react';
import { cn } from '~/lib/utils';
import { Text, Pressable } from 'react-native';
const Label = React.forwardRef<
React.ElementRef<typeof Text>,
React.ComponentPropsWithoutRef<typeof Text> & {
rootProps?: Omit<
React.ComponentPropsWithoutRef<typeof Pressable>,
'onPress'
>;
}
>(({ className, onPress, rootProps, ...props }, ref) => (
<Pressable
onPress={onPress}
className='rounded-md ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50'
{...rootProps}
>
<Text
ref={ref}
className={cn(
'native:text-lg text-foreground font-medium px-0.5 py-1.5 leading-none ',
className
)}
{...props}
/>
</Pressable>
));
Label.displayName = 'Label';
export { Label };