ScrollView child layout must be applied through the contentContainerStyle prop
See original GitHub issueVersion
1.4.6
Reproduction
import styled from 'styled-components/native';
const Scroll = styled.ScrollView`
align-items: 'center';
`;
this code throws an error
ScrollView child layout (["alignItems"]) must be applied through the contentContainerStyle prop.
Expected Behavior
I’d expect styled components would apply the property to the correct element.
Actual Behavior
I ended up writing
const styles = StyleSheet.create({
center: {
alignItems: 'center',
},
});
<ScrollView contentContainerStyle={styles.center}>
{children}
</Scroll>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:41
- Comments:12 (1 by maintainers)
Top Results From Across the Web
javascript - ScrollView child layout must be applied through ...
Use contentContainerStyle props instead of style props. contentContainerStyle={styles.wrapper}.
Read more >[Solved]-ScrollView child layout must be applied through the ...
Coding example for the question ScrollView child layout must be applied through the contentContainerStyle prop-Reactjs.
Read more >scrollview child layout justifycontent must be applied
scrollview child layout ( justifycontent ) must be applied through the contentcontainerstyle prop ; 1. //change your style prop in the scrollview ......
Read more >ScrollView child layout must be applied through the ... - iTecNote
Javascript – ScrollView child layout must be applied through the contentContainerStyle prop ... I am using react native swiper. and this error was...
Read more >Developers - ScrollView child layout must be applied through ...
ScrollView child layout must be applied through the contentContainerStyle prop. css-components. 11 May 2017 Posted by piuccio ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to perform this using the following:
If you are using react native with typescript, you can use it like this