Our project was recently updated to target RN072.5 and now uses the latest version of styled-components 6.0.8
"dependencies": {
...,
"react": "18.2.0",
"react-is": "18.2.0",
"react-native": "0.72.5",
"styled-components": "6.0.7",
"stylis": "^4.0.0"
},
"devDependencies": {
...,
"@types/react": "^18.0.24",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@typescript-eslint/typescript-estree": "^5.54.1",
"babel-plugin-styled-components": "^2.1.4",
},
resolutions: {
"styled-components": "^6"
}
When using the component below, TypeScript recognizes source and resizeMode as valid props
const BlurImage = styled.Image.attrs({
source: blur,
resizeMode: 'stretch'
})`
width: 100%;
height: 100%;
`;
However, upon trying to use the components, an error is encountered:
https://i.sstatic.net/1zkPE.png
Property source is missing in type {} but required in type
FastOmit<FastOmit<Substitute<ImageProps, ImageProps & RefAttributes<Image>>, never>, never>