This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,27 @@ const RNMasonryScrollView = ({
3535 columnStyle = null ,
3636 oddColumnStyle = null ,
3737 evenColumnStyle = null ,
38+ horizontal,
3839 ...otherProps
3940} : RNMasonryScrollViewProps ) => {
4041 const masonryGrid = generateMasonryGrid ( children , columns ) ;
4142
4243 return (
43- < ScrollView contentContainerStyle = { styles . columnStyle } { ...otherProps } >
44+ < ScrollView
45+ contentContainerStyle = {
46+ horizontal ? styles . horizontalColumnStyle : styles . verticalColumnStyle
47+ }
48+ horizontal = { horizontal }
49+ { ...otherProps }
50+ >
4451 { masonryGrid . map ( ( column , columnIndex ) => {
4552 return (
4653 < View
4754 key = { columnIndex }
4855 style = { [
56+ ! horizontal
57+ ? styles . horizontalColumnStyle
58+ : styles . verticalColumnStyle ,
4959 columnStyle ,
5060 columnIndex % 2 === 0 ? evenColumnStyle : oddColumnStyle
5161 ] }
@@ -59,7 +69,8 @@ const RNMasonryScrollView = ({
5969} ;
6070
6171const styles = StyleSheet . create ( {
62- columnStyle : { flexDirection : "row" }
72+ verticalColumnStyle : { flexDirection : "row" } ,
73+ horizontalColumnStyle : { flexDirection : "column" }
6374} ) ;
6475
6576export default RNMasonryScrollView ;
You can’t perform that action at this time.
0 commit comments