@@ -13,7 +13,7 @@ import {
1313 ResponsiveProp ,
1414 Breakpoint ,
1515} from '../utils'
16- import { useBreakpoint , useDebugStyle , useSpacing } from '../context'
16+ import { ColumnsContext , useBreakpoint , useDebugStyle , useSpacing } from '../context'
1717
1818export interface Props extends ViewProps {
1919 children : React . ReactNode
@@ -49,7 +49,7 @@ export const Columns = (props: Props) => {
4949 noOppositeMargin,
5050 spacing,
5151 direction,
52- columnStyle ,
52+ isCollapsed ,
5353 } = resolveCollapsibleProps ( {
5454 currentBreakpoint,
5555 collapseBelow,
@@ -58,26 +58,28 @@ export const Columns = (props: Props) => {
5858 } )
5959
6060 return (
61- < View
62- style = { [
63- style ,
64- styles . fullWidth ,
65- resolveDirection ( direction ) ,
66- resolveAlign ( alignY ) ,
67- resolveJustify ( alignX ) ,
68- ] }
69- { ...rest }
70- >
71- { elements . map ( ( child , index ) => {
72- const marginStyle = isLast ( index ) ? noLastMargin : spacing
61+ < ColumnsContext . Provider value = { { isCollapsed } } >
62+ < View
63+ style = { [
64+ style ,
65+ styles . fullWidth ,
66+ resolveDirection ( direction ) ,
67+ resolveAlign ( alignY ) ,
68+ resolveJustify ( alignX ) ,
69+ ] }
70+ { ...rest }
71+ >
72+ { elements . map ( ( child , index ) => {
73+ const marginStyle = isLast ( index ) ? noLastMargin : spacing
7374
74- return isValidElement ( child )
75- ? cloneElement ( child , {
76- ...child . props ,
77- style : [ child . props . style , columnStyle , debugStyle , noOppositeMargin , marginStyle ] ,
78- } )
79- : null
80- } ) }
81- </ View >
75+ return isValidElement ( child )
76+ ? cloneElement ( child , {
77+ ...child . props ,
78+ style : [ child . props . style , debugStyle , noOppositeMargin , marginStyle ] ,
79+ } )
80+ : null
81+ } ) }
82+ </ View >
83+ </ ColumnsContext . Provider >
8284 )
8385}
0 commit comments