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

Getting error "ReferenceError: Property 'CssSyntaxError' doesn't exist" while using styled-component in React native repack project. #4226

Closed
jigaradesara01 opened this issue Dec 7, 2023 · 2 comments · Fixed by #4243

Comments

@jigaradesara01
Copy link

Environment

"react": "18.2.0",
"react-native": "0.72.7",
"styled-components": "^6.1.1",
"@callstack/repack": "^3.6.0"

Description

I'm trying to use styled-component in react native repack project but getting "Property 'CssSyntaxError' doesn't exist react native" while running the project.

Repack project sample:
https://github.com/callstack/repack

Screenshot 2023-12-05 at 8 44 52 AM

Screenshot_1701746204

##LocalModule.tsx

import { Text } from 'react-native';
import styled from 'styled-components/native';

const LocalModule = () => {
    return (
        <Container>
            <Text >React Native</Text>
        </Container>
    );
};

const Container = styled.View`
      flex: 1;
      background-color: white;
      align-items: center;
      justify-content: center;
    `;


export default LocalModule;
```

Thanks in advance.
@quantizor
Copy link
Contributor

My guess is multiple versions of postcss are installed and it's causing issues. We could add postcss to peerDependencies so it dedupes better.

@quantizor
Copy link
Contributor

Try styled-components@6.1.5-rc.0 and let me know if that resolves it (adds postcss as a peer dependency)

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

Successfully merging a pull request may close this issue.

2 participants