question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No style typings when using `styled(Animated.View)` in React Native and Emotion 11

See original GitHub issue

Current behavior:

When I use styled(Animated.View)({ ... }) my style object seem to have the any type, instead of ViewStyle.

To reproduce:

  1. Create a styled animated component like described above.
  2. See that the styles have no type (no autocompletion in VSCode) 😃

Expected behavior:

Style object should be of type ViewStyle.

Environment information:

  • react version: 16.11.0
  • emotion version: ^11.0.0-next.14

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Andaristcommented, Nov 20, 2020

Let’s close it then and pretend that nothing has happened 😉

0reactions
efokencommented, Nov 20, 2020

@Andarist This somehow works now 😄 I have "@types/react-native": "^0.63.35" and "typescript": "^4.0.5"

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using styled components with Typescript, prop does not exist?
The styled component will have to specify the prop to pass to the component like styled("h2")<IProps> . You can read more about the...
Read more >
FAQs - styled-components
In a React Native project using TypeScript, it is because you need to add @types/styled-components-react-native.
Read more >
Styled Components - Emotion
styled is a way to create React components that have styles attached to them. It's available from @emotion/styled. styled was heavily inspired by ......
Read more >
Animated - React Native
By using the native driver, we send everything about the animation to native before starting the animation, allowing native code to perform the ......
Read more >
How to style React Router links with styled-components
One helpful solution to this challenge is a CSS-in-JS library called styled-components. This tool allows us to construct and manage our styles ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found