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

confused viewBox in react-native #243

Open
GreatAuk opened this issue May 19, 2021 · 2 comments
Open

confused viewBox in react-native #243

GreatAuk opened this issue May 19, 2021 · 2 comments

Comments

@GreatAuk
Copy link

What did you do?

Please include the actual source code causing the issue.

import React from 'react'
import ContentLoader, { Rect } from 'react-content-loader/native'

const MyLoader = (props) => (
  <ContentLoader
    speed={2}
    width="100%"
    height="100%"
    viewBox="0 0 100 60"
    backgroundColor="#f3f3f3"
    style={{ backgroundColor: 'red' }}
    foregroundColor="#ecebeb"
    // {...props}
  >
    <Rect x="0" y="0" rx="2" ry="2" width="40" height="60" />
    <Rect x="45" y="0" rx="2" ry="2" width="40" height="60" />
  </ContentLoader>
)

export default MyLoader
// use
<View style={{ height: 75, width: '100%' }}>
  <MyCodeLoader />
</View>

What did you expect to happen?

Please mention the expected behaviour.
image

What happened actually?

image

Which versions of react-content-loader, and which browser are affected by this issue?

Please also mention the version of react.

@rohankan
Copy link

rohankan commented Aug 12, 2021

I'm also facing this issue while using Metro with React Native v0.64.1 and react-content-loader v6.0.3. After changing the viewBox property on a ContentLoader and reloading the app with Metro, the viewBox does not update.

However, a temporary solution I found was to rebuild the app: after changing the viewBox property on a ContentLoader, rebuilding the app causes the viewBox to update correctly.

@raldred
Copy link

raldred commented Aug 28, 2021

I have removed the viewbox attribute entirely when using ContentLoader, just using width and height and containing in a regular View component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants