Skip to content

Commit

Permalink
Merge branch 'patch' of github.com:gluestack/gluestack-ui into patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj authored and Suraj committed Mar 5, 2024
2 parents 8c9aae6 + b56beb8 commit 38e25fb
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import React from 'react';
import { View } from 'react-native';
import { tva } from '@gluestack-ui/nativewind-utils';
import { tva, VariantProps } from '@gluestack-ui/nativewind-utils';

const boxStyle = tva({});
const Box = React.forwardRef(({ className, ...props }: any, ref) => {
return (
<View ref={ref} {...props} className={boxStyle({ class: className })} />
);
});

type IBoxProps = React.ComponentProps<typeof View> &
VariantProps<typeof boxStyle>;

const Box = React.forwardRef(
({ className, ...props }: IBoxProps, ref?: any) => {
return (
<View ref={ref} {...props} className={boxStyle({ class: className })} />
);
}
);

Box.displayName = 'Box';
export { Box };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { tva } from '@gluestack-ui/nativewind-utils';
import { tva, VariantProps } from '@gluestack-ui/nativewind-utils';
import { Text as RNText } from 'react-native';

const textStyle = tva({
Expand Down Expand Up @@ -43,35 +43,44 @@ const textStyle = tva({
},
});

const Text = ({
className,
isTruncated,
bold,
underline,
strikeThrough,
size = 'md',
sub,
italic,
highlight,
...props
}: any) => {
return (
<RNText
className={textStyle({
isTruncated,
bold,
underline,
strikeThrough,
size,
sub,
italic,
highlight,
class: className,
})}
{...props}
/>
);
};
type ITextProps = React.ComponentProps<typeof RNText> &
VariantProps<typeof textStyle>;

const Text = React.forwardRef(
(
{
className,
isTruncated,
bold,
underline,
strikeThrough,
size = 'md',
sub,
italic,
highlight,
...props
}: ITextProps,
ref?: any
) => {
return (
<RNText
className={textStyle({
isTruncated,
bold,
underline,
strikeThrough,
size,
sub,
italic,
highlight,
class: className,
})}
{...props}
ref={ref}
/>
);
}
);

Text.displayName = 'Text';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { tva } from '@gluestack-ui/nativewind-utils';
import { tva, VariantProps } from '@gluestack-ui/nativewind-utils';
import { View } from 'react-native';

const vstackStyle = tva({
Expand All @@ -21,14 +21,20 @@ const vstackStyle = tva({
},
});

const VStack = ({ className, space, reversed, ...props }: any) => {
return (
<View
className={vstackStyle({ space, reversed, class: className })}
{...props}
/>
);
};
type IVStackProps = React.ComponentProps<typeof View> &
VariantProps<typeof vstackStyle>;

const VStack = React.forwardRef(
({ className, space, reversed, ...props }: IVStackProps, ref?: any) => {
return (
<View
className={vstackStyle({ space, reversed, class: className })}
{...props}
ref={ref}
/>
);
}
);

VStack.displayName = 'VStack';

Expand Down
2 changes: 1 addition & 1 deletion packages/nativewind/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ios",
"nextjs"
],
"version": "0.0.7",
"version": "0.0.8",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions packages/nativewind/utils/src/context.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { createContext, useContext } from 'react';
export const ParentContext = createContext({});

Expand Down
2 changes: 2 additions & 0 deletions packages/nativewind/utils/src/withStates.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import { extractDataClassName } from './utils';

Expand Down
1 change: 1 addition & 0 deletions packages/nativewind/utils/src/withStyleContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import React from 'react';
import { ParentContext } from './context';

Expand Down
2 changes: 2 additions & 0 deletions packages/nativewind/utils/src/withStyleContextAndStates.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import { extractDataClassName } from './utils';
import { ParentContext } from './context';
Expand Down

0 comments on commit 38e25fb

Please sign in to comment.