@crossed/primitive
Version:
A universal & performant styling library for React Native, Next.js & React
32 lines (27 loc) • 869 B
text/typescript
/**
* Copyright (c) Paymium.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root of this projects source tree.
*/
import { withStaticProperties } from '@crossed/core';
import type { ComponentType } from 'react';
import type { TextProps as NTextProps } from 'react-native';
import { createBadgeMain } from './Badge';
import { createBadgeText } from './BadgeText';
export const createBadge = <
BadgeProps extends Record<string, any>,
TextProps extends NTextProps,
>(components: {
Root: ComponentType<BadgeProps>;
Text: ComponentType<TextProps>;
}) => {
const { Root, Text } = components;
const Badge = createBadgeMain(Root);
const BadgeText = createBadgeText(Text);
Badge.displayName = 'Badge';
BadgeText.displayName = 'BadgeText';
return withStaticProperties(Badge, {
Text: BadgeText,
});
};