File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
113113 isIndeterminate,
114114 isDisabled,
115115 style,
116+ index,
116117 } = props ;
117118
118119 const hasOnlyLabel = label && ! description ;
@@ -351,6 +352,9 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
351352 tailwind . style (
352353 cx (
353354 checkboxTheme ?. label ?. common ,
355+ index !== 0
356+ ? checkboxTheme ?. group [ checkboxGroupState . orientation ] ?. spacing
357+ : "" ,
354358 description ? checkboxTheme ?. label ?. withDescription : "" ,
355359 checkboxTheme . size [ size ] ?. label ?. wrapper ,
356360 touchState . pressed
Original file line number Diff line number Diff line change @@ -12,13 +12,14 @@ import {
1212 createContext ,
1313 cx ,
1414 getValidChildren ,
15+ passProps ,
1516 styleAdapter ,
1617} from "../../utils" ;
1718
1819import { CheckboxSizes , CheckboxTheme } from "./Checkbox" ;
1920
2021interface CheckboxGroupContext
21- extends Pick < CheckboxGroupProps , "size" | "themeColor" > ,
22+ extends Pick < CheckboxGroupProps , "size" | "themeColor" | "orientation" > ,
2223 CheckboxGroupState { }
2324
2425const [ CheckboxGroupProvider , useCheckboxGroupContext ] =
@@ -98,17 +99,14 @@ const RNCheckboxGroup: React.FC<Partial<CheckboxGroupProps>> = forwardRef<
9899 accessibilityRole = { Platform . OS === "web" ? "group" : undefined }
99100 ref = { ref }
100101 >
101- < CheckboxGroupProvider value = { { ...state , size, themeColor } } >
102- { validChildren . map ( ( renderElement , index ) => (
103- < Box
104- key = { index }
105- style = { tailwind . style (
106- cx ( checkboxGroupTheme . group [ orientation ] ?. spacing ) ,
107- ) }
108- >
109- { renderElement }
110- </ Box >
111- ) ) }
102+ < CheckboxGroupProvider
103+ value = { { ...state , size, themeColor, orientation } }
104+ >
105+ { validChildren . map ( ( renderElement , index ) =>
106+ passProps ( renderElement , {
107+ index,
108+ } ) ,
109+ ) }
112110 </ CheckboxGroupProvider >
113111 </ Box >
114112 ) ;
Original file line number Diff line number Diff line change 11export const checkbox = {
22 group : {
33 vertical : {
4- common : "flex flex-col items-start " ,
4+ common : "flex flex-col" ,
55 spacing : "mt-1" ,
66 } ,
77 horizontal : {
@@ -67,7 +67,7 @@ export const checkbox = {
6767 wrapper : "min-h-9 px-3 py-2 rounded-[10px]" ,
6868 } ,
6969 icon : {
70- wrapper : "w-5 h-5 text-base rounded" ,
70+ wrapper : "w-5 h-5 text-base rounded-md " ,
7171 iconSize : "w-4 h-4" ,
7272 } ,
7373 text : {
You can’t perform that action at this time.
0 commit comments