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.

Flow: styled-components/native. Required module not found

See original GitHub issue

Version

styled-components@2.1.1 flow-bin@0.47.0 flow-typed@2.1.5

Reproduction

Bootstrapped app with create-react-native-app. Installed storybook, styled-components and added flow. Installed definitions: flow-typed install styled-components@2.1.1

Have really simple component:

/* @flow */
import React, { Children } from 'react';
import styled from 'styled-components/native';

type Props = {
  onPress: Function,
  children: Children
};

const Wrapper = styled.TouchableOpacity`background-color: steelblue;`;

const Button = ({ onPress, children }: Props) =>
  <Wrapper onPress={onPress}>
    {children}
  </Wrapper>;

export { Button as default };

When I run flow, I’m getting this error:

screen shot 2017-08-02 at 15 40 14

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
kittencommented, Aug 9, 2017

As it seems that none of the issues here seem to be issues with our typings, but usage issues, I have to ask you to try to:

  • Use the exact instructions (including the exact flowconfig without extra sections) in the docs: https://www.styled-components.com/docs/api#flow
  • Try the mentioned lib trick above
  • Open a new issue with a reproduction repo adhering to the issue template

As the original poster resolved this and we don’t have a reproduction right now, I’d prefer new issues with more detailed descriptions instead of keeping a potentially unrelated issue going. Sorry 😄

0reactions
IvanCoronadocommented, Aug 4, 2017

@relekang Same problem here, the project was working fine but after remove node_modules and install it again with yarn. I got the same problem. (with create-react-app without native)

[ignore]
.*/node_modules/styled-components/.*
.*/node_modules/stylelint/.*

[include]

[libs]

[options]

[lints]

styled-components@2.1.1 flow-bin@0.50.0 flow-typed@2.1.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve the required module not found error in flow.js
Create a folder named flow-typed at the root of the project. 1.2 Create the definition file. Create a file which has the same...
Read more >
Module not found: Can't resolve 'styled-component' [closed]
I created a new react app using create-react-app and then installed styled-component using npm . But when I use it in component, I...
Read more >
How to fix error TS7016: Could not find a declaration file for ...
Try `npm install @types/XYZ` if it exists or add a new declaration (.d.ts) file containing `declare module 'XYZ';. If XYZ is a direct...
Read more >
API Reference - styled-components
Returns a StyledComponent that does not accept children. Place it at the top of your React tree and the global styles will be...
Read more >
styled-components-native-esm | Yarn - Package Manager
Changelog. All notable changes to this project will be documented in this file. If a contribution does not have a mention next to...
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