Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theming is not working as expected #275

Open
2 tasks done
Forium777 opened this issue Sep 7, 2023 · 1 comment
Open
2 tasks done

Theming is not working as expected #275

Forium777 opened this issue Sep 7, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Forium777
Copy link

Current behavior

I apply a borderRadius={'round'} which is defined in my Theme.tsx but it doesn't get applied to my SkeletonPlaceholder.Item whereas if I do borderRadius={1000} - rectangle becomes circle...

With borderRadius={'round'}
Simulator Screen Shot - iPhone 14 Pro - 2023-09-07 at 15 35 08

With borderRadius={1000}
Simulator Screen Shot - iPhone 14 Pro - 2023-09-07 at 15 36 23

Code:

import { Box, Theme } from '@/components/Theme';
import {
  border,
  createRestyleComponent,
} from '@shopify/restyle';
import SkeletonPlaceholder from 'react-native-skeleton-placeholder';


const SkeletonPlaceholderItem = createRestyleComponent<
  React.ComponentProps<typeof SkeletonPlaceholder.Item & typeof Box>,
  Theme
>([border], SkeletonPlaceholder.Item)

const RoundedSkeleton = ({ size = 100 }) => {
  return (
    <SkeletonPlaceholder>
      <SkeletonPlaceholderItem
        width={size}
        height={size}
        borderRadius={`round`} // result with borderRadius={1000} in screen 2
      />
    </SkeletonPlaceholder>
  )
}

export { RoundedSkeleton };

Expected behavior

borderRadius={'round'} should get applied with value from my Theme.tsx which is:

borderRadii: {
    none: 0,
    s: 4,
    ms: 6,
    m: 8,
    lm: 10,
    l: 12,
    xl: 20,
    round: 1000,
},

Platform:

  • iOS
  • Android

Environment

"@shopify/restyle": "^2.4.2",

@Forium777 Forium777 added the bug Something isn't working label Sep 7, 2023
@laogui
Copy link

laogui commented Jan 16, 2024

Only components created using createText or createBox can be used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants