Skip to content

Commit

Permalink
Merge pull request #2050 from gluestack/fix/img-nativewind
Browse files Browse the repository at this point in the history
fix: image component
  • Loading branch information
Viraj-10 authored Apr 9, 2024
2 parents 1530157 + 03cc9b2 commit 9892055
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cssInterop(UIButton.Spinner, { className: 'style' });
cssInterop(UIButton.Icon, { className: 'style' });

const buttonStyle = tva({
base: 'group/button rounded-lg bg-primary-500 flex-row items-center justify-center data-[focus-visible=true]:web:outline-none data-[focus-visible=true]:web:ring-2 data-[disabled=true]:opacity-40',
base: 'group/button rounded bg-primary-500 flex-row items-center justify-center data-[focus-visible=true]:web:outline-none data-[focus-visible=true]:web:ring-2 data-[disabled=true]:opacity-40',
variants: {
action: {
primary:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { createImage } from '@gluestack-ui/image';
import { Image as RNImage } from 'react-native';
import { tva } from '@gluestack-ui/nativewind-utils/tva';
import { cssInterop } from '@gluestack-ui/nativewind-utils/cssInterop';
import { Platform } from 'react-native';

const imageStyle = tva({
base: 'max-w-full lg:h-[revert-layer] lg:w-[revert-layer]',
base: 'max-w-full',
variants: {
size: {
'2xs': 'h-6 w-6',
Expand All @@ -26,7 +27,15 @@ cssInterop(UIImage, { className: 'style' });

const Image = ({ size = 'md', className, ...props }: any) => {
return (
<UIImage className={imageStyle({ size, class: className })} {...props} />
<UIImage
className={imageStyle({ size, class: className })}
{...props}
style={
Platform.OS === 'web'
? { height: 'revert-layer', width: 'revert-layer' }
: undefined
}
/>
);
};

Expand Down

0 comments on commit 9892055

Please sign in to comment.