Skip to content

Commit 5ab57a8

Browse files
authored
Merge pull request #4634 from GeekyAnts/release/3.3.6-rc.2
release 3.3.6-rc.2
2 parents f23f6f1 + 3bf4bbf commit 5ab57a8

File tree

10 files changed

+48
-26
lines changed

10 files changed

+48
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"prettier --write"
3838
]
3939
},
40-
"version": "3.3.6-rc.1",
40+
"version": "3.3.6-rc.2",
4141
"license": "MIT",
4242
"private": false,
4343
"main": "lib/commonjs/index",

src/components/composites/AspectRatio/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,25 @@ const AspectView = forwardRef((props: any, ref?: any) => {
3131
});
3232

3333
const AspectRatio = (props: IAspectRatioProps, ref?: any) => {
34-
const { style, ratio, children, ...resolvedProps } = usePropsResolution(
34+
const {
35+
style,
36+
ratio,
37+
children = <></>,
38+
...resolvedProps
39+
} = usePropsResolution(
3540
'AspectRatio',
3641
props,
3742
{},
3843
{ resolveResponsively: ['ratio'] }
3944
);
4045
let computedStyle: ViewStyle | undefined = style;
41-
let newChildWithProps = React.cloneElement(
46+
const newChildWithProps = React.cloneElement(
4247
children,
4348
{
44-
...children.props,
49+
...children?.props,
4550
style: StyleSheet.absoluteFillObject,
4651
},
47-
children.props.children
52+
children?.props?.children
4853
);
4954

5055
//TODO: refactor for responsive prop

src/components/composites/IconButton/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const IconButton = (
2020
isPressed: isPressedProp,
2121
isFocused: isFocusedProp,
2222
isFocusVisible: isFocusVisibleProp,
23+
isDisabled,
2324
...props
2425
}: IIconButtonProps,
2526
ref: any
@@ -43,6 +44,7 @@ const IconButton = (
4344
isPressed: isPressedProp || isPressed,
4445
isFocused: isFocusedProp || isFocused,
4546
isFocusVisible: isFocusVisibleProp || isFocusVisible,
47+
isDisabled,
4648
});
4749

4850
let clonedIcon;

src/components/primitives/Checkbox/Checkbox.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const Checkbox = (
4444
defaultSelected: combinedProps.defaultIsChecked,
4545
isSelected: combinedProps.isChecked,
4646
});
47-
4847
const _ref = React.useRef();
4948
const mergedRef = mergeRefs([ref, _ref]);
5049

@@ -77,7 +76,6 @@ const Checkbox = (
7776
...checkboxGroupContext,
7877
...combinedProps,
7978
});
80-
8179
return (
8280
<CheckboxComponent
8381
inputProps={inputProps}
@@ -124,16 +122,20 @@ const CheckboxComponent = React.memo(
124122
onFocus,
125123
onBlur,
126124
...resolvedProps
127-
} = usePropsResolution('Checkbox', inputProps, {
128-
isInvalid,
129-
isReadOnly,
130-
isIndeterminate,
131-
isDisabled,
132-
isChecked,
133-
isHovered: isHoveredProp || isHovered,
134-
isPressed: isPressedProp || isPressed,
135-
isFocused: isFocusedProp || isFocused,
136-
});
125+
} = usePropsResolution(
126+
'Checkbox',
127+
{ ...combinedProps, ...inputProps },
128+
{
129+
isInvalid,
130+
isReadOnly,
131+
isIndeterminate,
132+
isDisabled,
133+
isChecked,
134+
isHovered: isHoveredProp || isHovered,
135+
isPressed: isPressedProp || isPressed,
136+
isFocused: isFocusedProp || isFocused,
137+
}
138+
);
137139

138140
const [layoutProps, nonLayoutProps] = extractInObject(resolvedProps, [
139141
...stylingProps.margin,

src/components/primitives/Checkbox/CheckboxGroup.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const CheckboxGroupContext = createContext<ICheckboxContext | null>(
1111
);
1212

1313
function CheckboxGroup(
14-
{ size, colorScheme, ...props }: ICheckboxGroupProps,
14+
{ size, _checkbox, colorScheme, ...props }: ICheckboxGroupProps,
1515
ref?: any
1616
) {
1717
const { children } = props;
@@ -20,6 +20,7 @@ function CheckboxGroup(
2020
{ 'aria-label': props.accessibilityLabel, ...props },
2121
state
2222
);
23+
2324
const formControlContext = useFormControlContext();
2425
//TODO: refactor for responsive prop
2526
if (useHasResponsiveProps({ ...props, size, colorScheme })) {
@@ -30,6 +31,7 @@ function CheckboxGroup(
3031
value={{
3132
size,
3233
colorScheme,
34+
..._checkbox,
3335
...formControlContext,
3436
state,
3537
}}

src/components/primitives/Checkbox/types.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ export interface ICheckboxGroupProps extends IBoxProps<ICheckboxGroupProps> {
153153
* The callback fired when any children Checkbox is checked or unchecked.
154154
*/
155155
onChange?: (values: any) => any;
156+
/**
157+
* Pass props will be passed to each checkbox.
158+
*/
159+
_checkbox?: ICheckboxProps;
156160
}
157161
export interface ICheckboxContext extends IFormControlContext {
158162
colorScheme?: string;

src/components/primitives/Radio/Radio.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const RadioComponent = memo(
3939
ref: any
4040
) => {
4141
const { isInvalid, isReadOnly, isIndeterminate } = combinedProps;
42-
4342
const { hoverProps, isHovered } = useHover();
4443
const { pressableProps, isPressed } = useIsPressed();
4544
const { focusProps, isFocused } = useFocus();
@@ -158,9 +157,10 @@ const Radio = (
158157
) => {
159158
const formControlContext = useFormControlContext();
160159
const contextState = React.useContext(RadioContext);
161-
162-
const combinedProps = combineContextAndProps(formControlContext, props);
163-
160+
const combinedProps = combineContextAndProps(
161+
{ ...formControlContext, ...contextState },
162+
props
163+
);
164164
const inputRef = React.useRef(null);
165165
const radioState = useRadio(
166166
{ ...combinedProps, 'aria-label': props.accessibilityLabel, children },

src/components/primitives/Radio/Radio.web.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const RadioComponent = memo(
3131
ref: any
3232
) => {
3333
const { isInvalid, isReadOnly, isIndeterminate } = combinedProps;
34-
3534
const { disabled: isDisabled, checked: isChecked } = inputProps;
3635
const _ref = React.useRef(null);
3736
const { isHovered } = useHover({}, _ref);
@@ -152,7 +151,10 @@ const Radio = (
152151
const formControlContext = useFormControlContext();
153152
const contextState = React.useContext(RadioContext);
154153

155-
const combinedProps = combineContextAndProps(formControlContext, props);
154+
const combinedProps = combineContextAndProps(
155+
{ ...formControlContext, ...contextState },
156+
props
157+
);
156158

157159
const inputRef = React.useRef(null);
158160
const radioState = useRadio(

src/components/primitives/Radio/RadioGroup.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const RadioWrapper = React.memo((props: any) => {
1919
});
2020

2121
const RadioGroup = (
22-
{ size, colorScheme, ...props }: IRadioGroupProps,
22+
{ size, colorScheme, _radio, ...props }: IRadioGroupProps,
2323
ref: any
2424
) => {
2525
const formControlContext = useFormControlContext();
@@ -35,9 +35,10 @@ const RadioGroup = (
3535
formControlContext,
3636
size,
3737
colorScheme,
38+
..._radio,
3839
state,
3940
};
40-
}, [size, colorScheme, formControlContext, state]);
41+
}, [size, colorScheme, formControlContext, state, _radio]);
4142

4243
const radioGroupProps = React.useMemo(
4344
() => radioGroupState.radioGroupProps,

src/components/primitives/Radio/types.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ export interface IRadioGroupProps extends IBoxProps<IRadioGroupProps> {
9191
* The callback fired when any children radio is checked or unchecked.
9292
*/
9393
onChange?: IRadioGroupOnChangeHandler;
94+
/**
95+
* Pass props will be passed to each radio.
96+
*/
97+
_radio?: IRadioProps;
9498
}
9599
export interface IRadioContext extends IFormControlContext {
96100
colorScheme?: string;

0 commit comments

Comments
 (0)