React Native Typescript styled components error

I keep getting the following error when trying to use styled components in react native and typescript:

WARN  Possible Unhandled Promise Rejection (id: 1):
Error: Directory for 'file:///Users/me/Library/Developer/CoreSimulator/Devices/12EBA58B-1919-42F7-A255-0AB501875563/data/Containers/Data/Application/8BD96CA0-A291-4840-A694-EB6F0D92867F/Library/Caches/ExponentExperienceData/%2540anonymous%252FDrinklink-c6446bc2-812f-446d-b2ff-ff09cb07de2a/ExponentAsset-b62641afc9ab487008e996a5c5865e56.ttf' doesn't exist.

Installed with: yarn add @types/styled-components-react-native So I have version 5.1.3

Imported by: import styled from "styled-components/native";

Styled component code:

const Title = styled.Text`
  padding: 16px;
`;
export type Props = {
  vendor: any;
};

const VendorInfo: React.FC<Props> = ({ vendor }) => {
  const { title, image } = vendor;
  return (
    <Card elevation={5} style={styles.card}>
      <Card.Cover style={styles.cover} source={{ uri: image }} />
      <Title>{title}</Title>
    </Card>
  );
};

Ive tried various things to get styled components react native to work and so far have had no luck. Appreciate any suggestions.

Upvotes: 0

Views: 484

Answers (1)

dev404
dev404

Reputation: 1125

Have you added a resolutions section in package.json?

{
  "resolutions": {
    "styled-components": "^5"
  }
}

And then run yarn install again

Upvotes: 0

Related Questions