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

No sign of FlareComponent getting rendered #24

Open
obitodarky opened this issue Jan 1, 2020 · 2 comments
Open

No sign of FlareComponent getting rendered #24

obitodarky opened this issue Jan 1, 2020 · 2 comments

Comments

@obitodarky
Copy link

I'm using my animation in a react app and I used the following code to add my animation

    render={data => (
      <OuterContainer>
        <Container>
          <NameHeader>{data.site.siteMetadata.title}
          <FlareComponent width="200" height="200" animationName="green" file="light.flr" />
          </NameHeader>
          <Description>{data.site.siteMetadata.subtitle}</Description>
        </Container>
      </OuterContainer>
    )}

I checked the Component with my React Developer tool and this is what I found in my FlareComponent
image

The console showed me the following error

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data FlareReact.js:9534

Here is my React file for a reference.
You can also find the flare files(I tried it with both Binary and JSON) in the components directory of the repo

@batbrain9392
Copy link

batbrain9392 commented Jan 10, 2020

Try importing it like - import minion from './minion.flr'

@endurance21
Copy link

endurance21 commented Aug 25, 2020

@obitodarky one thing about the CRA is that, file paths other than used in import/export must be relative to public/ folder because after build process, your final js is filled all into index.html by webpack in the CRA....

When browser renders index.html its assumes that there must
'./minion.flr' in the same folder as index.html that is inside of public folder..

So place your minion.flr file in public folder and Enjoy!!!

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