install new components

This commit is contained in:
2025-06-04 19:32:36 +02:00
parent d3b70cd842
commit 35efcbe3a8
5 changed files with 1068 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { View, ViewProps } from 'react-native';
import React from 'react';
import { centerStyle } from './styles';
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
type ICenterProps = ViewProps & VariantProps<typeof centerStyle>;
const Center = React.forwardRef<React.ComponentRef<typeof View>, ICenterProps>(
function Center({ className, ...props }, ref) {
return (
<View
className={centerStyle({ class: className })}
{...props}
ref={ref}
/>
);
}
);
Center.displayName = 'Center';
export { Center };

View File

@@ -0,0 +1,20 @@
import React from 'react';
import { centerStyle } from './styles';
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
type ICenterProps = React.ComponentPropsWithoutRef<'div'> &
VariantProps<typeof centerStyle>;
const Center = React.forwardRef<HTMLDivElement, ICenterProps>(function Center(
{ className, ...props },
ref
) {
return (
<div className={centerStyle({ class: className })} {...props} ref={ref} />
);
});
Center.displayName = 'Center';
export { Center };

View File

@@ -0,0 +1,8 @@
import { tva } from '@gluestack-ui/nativewind-utils/tva';
import { isWeb } from '@gluestack-ui/nativewind-utils/IsWeb';
const baseStyle = isWeb ? 'flex flex-col relative z-0' : '';
export const centerStyle = tva({
base: `justify-center items-center ${baseStyle}`,
});

View File

@@ -0,0 +1,40 @@
'use client';
import React from 'react';
import { tva } from '@gluestack-ui/nativewind-utils/tva';
import { Platform, View } from 'react-native';
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
const dividerStyle = tva({
base: 'bg-background-200',
variants: {
orientation: {
vertical: 'w-px h-full',
horizontal: 'h-px w-full',
},
},
});
type IUIDividerProps = React.ComponentPropsWithoutRef<typeof View> &
VariantProps<typeof dividerStyle>;
const Divider = React.forwardRef<
React.ComponentRef<typeof View>,
IUIDividerProps
>(function Divider({ className, orientation = 'horizontal', ...props }, ref) {
return (
<View
ref={ref}
{...props}
aria-orientation={orientation}
role={Platform.OS === 'web' ? 'separator' : undefined}
className={dividerStyle({
orientation,
class: className,
})}
/>
);
});
Divider.displayName = 'Divider';
export { Divider };