Error in Image component with css attribute (react-native-web)
Please correct me if I am wrong - Uranium works by adding <style> child in a component with css attribute.However, since [email protected] and [email protected], <Image> with nested component is not supported. This is the error:
The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.
References:
- https://github.com/facebook/react-native/releases/tag/v0.50.0
- https://github.com/necolas/react-native-web/releases/tag/0.2.0
@made-aryadinata I have same issue, if Image component has children then we shoud use ImageBackground, but if your Image component not contain any child and still have error message
....Image component cannot contain children
In my case I solve the issue by replace css props with style props and keep using Image component. Because the css props just adding nested <style> in the image component... so we can replace css props if only if we are not using @media query in the image component styling.