Skip to content

Commit

Permalink
Merge pull request #5533 from GeekyAnts/release/3.4.21
Browse files Browse the repository at this point in the history
release 3.4.21
  • Loading branch information
surajahmed committed Nov 3, 2022
2 parents 35ee103 + 13778e2 commit 5c52b85
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 37 deletions.
4 changes: 2 additions & 2 deletions example/storybook/stories/components/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function MyWrapper({ children }: any) {
bg={bgColor}
safeAreaY
>
{/* <Tooltip
<Tooltip
label={colorMode === 'dark' ? 'Enable light mode' : 'Enable dark mode'}
placement="bottom right"
openDelay={300}
Expand All @@ -138,7 +138,7 @@ function MyWrapper({ children }: any) {
icon={colorMode === 'dark' ? <SunIcon /> : <MoonIcon />}
size="lg"
/>
</Tooltip> */}
</Tooltip>
{children}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {

export const Example = () => {
return (
<Stack alignItems="center">
<InputGroup w={{ base: '70%', md: '285' }}>
<Stack>
<InputGroup w={{ base: '70%', md: '285' }} justifyContent="center">
<InputLeftAddon children={'https://'} />
<Input w={{ base: '70%', md: '100%' }} placeholder="nativebase" />
<InputRightAddon children={'.io'} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
export const Example = () => {
return (
<Center>
<FormControl w="3/4" maxW="300" isRequired isInvalid>
<FormControl maxW="300" isRequired isInvalid>
<FormControl.Label>Choose service</FormControl.Label>
<Select
minWidth="200"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export const Example = () => {
];
return (
<Container>
<FormControl>
<FormControl maxW="300">
<FormControl.Label>Select Color</FormControl.Label>
<Select
selectedValue={value}
minWidth="100"
minWidth="200"
accessibilityLabel="Select a Color"
placeholder="Select a Color"
onValueChange={(itemValue) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prettier --write"
]
},
"version": "3.4.20",
"version": "3.4.21",
"license": "MIT",
"private": false,
"main": "lib/commonjs/index",
Expand Down
36 changes: 12 additions & 24 deletions src/components/composites/Avatar/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const getAvatarGroupChildren = (
plusAvatars = childrenArray.length - max;
childrenArray = childrenArray.slice(0, max);
}
const trailingChildren = childrenArray.slice(1);
const spacingProps = {
ml: isVertical ? 0 : space,
mt: isVertical ? space : 0,
Expand All @@ -38,29 +37,18 @@ const getAvatarGroupChildren = (
{'+ ' + plusAvatars}
</Avatar>
) : null,
React.Children.map(
trailingChildren.reverse(),
(child: any, index: number) => {
return React.cloneElement(
child,
{
key: `avatar-group-child-${index}`,
..._avatar,
...spacingProps,
...child.props,
},
child.props.children
);
}
),
React.cloneElement(
childrenArray[0],
{
..._avatar,
...childrenArray[0].props,
},
childrenArray[0].props.children
),
React.Children.map(childrenArray.reverse(), (child: any, index: number) => {
return React.cloneElement(
child,
{
key: `avatar-group-child-${index}`,
..._avatar,
...spacingProps,
...child.props,
},
child.props.children
);
}),
];
};

Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Popover = (
finalFocusRef,
useRNModal,
trapFocus = true,
_backdrop,
...props
}: IPopoverProps,
ref: any
Expand Down Expand Up @@ -101,7 +102,7 @@ const Popover = (
style={StyleSheet.absoluteFill}
>
<Popper onClose={handleClose} triggerRef={triggerRef} {...props}>
<Backdrop onPress={handleClose} bg="transparent" />
<Backdrop onPress={handleClose} bg="transparent" {..._backdrop} />
<PopoverContext.Provider
value={{
onClose: handleClose,
Expand Down
4 changes: 4 additions & 0 deletions src/components/composites/Popover/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export interface InterfacePopoverProps {
* @default false
*/
useRNModal?: boolean;
/**
* Props applied on backdrop.
*/
_backdrop?: any;
}

export type IPopoverContentImpl = {
Expand Down
5 changes: 3 additions & 2 deletions src/factory/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export default function Factory<P>(
componentTheme?: ComponentTheme
) {
return React.forwardRef(
({ children, ...props }: P & FactoryComponentProps, ref: any) => {
({ children, _state, ...props }: P & FactoryComponentProps, ref: any) => {
const StyledComponent = useMemo(() => makeStyledComponent(Component), []);
const calculatedProps = usePropsWithComponentTheme(
componentTheme ?? {},
props
props,
_state
);
return (
<StyledComponent {...(calculatedProps as P)} ref={ref}>
Expand Down
2 changes: 2 additions & 0 deletions src/factory/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { PlatformProps } from '../components/types';
import type { StyledProps } from '../theme/types';
import type { IStateProps } from '../hooks/useThemeProps/propsFlattener';

export type FactoryComponentProps = StyledProps &
PlatformProps<StyledProps> & {
children?: string | JSX.Element | JSX.Element[];
_state?: IStateProps;
};
10 changes: 8 additions & 2 deletions src/hooks/useThemeProps/usePropsWithComponentTheme.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { usePropsResolutionWithComponentTheme } from './usePropsResolution';
import type { ComponentTheme } from '../../theme';
import type { IStateProps } from './propsFlattener';

export function usePropsWithComponentTheme(
localTheme: ComponentTheme,
propsReceived: any
propsReceived: any,
_state?: IStateProps
) {
return usePropsResolutionWithComponentTheme(localTheme, propsReceived);
return usePropsResolutionWithComponentTheme(
localTheme,
propsReceived,
_state
);
}
3 changes: 3 additions & 0 deletions src/theme/components/actionsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const ActionsheetContent = {
py: 2,
borderRadius: 'none',
roundedTop: 20,
_web: {
userSelect: 'none',
},
_dragIndicator: {
height: 1,
width: 10,
Expand Down
1 change: 1 addition & 0 deletions src/theme/styled-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const flexbox = {
flexDirection: true,
flexDir: {
property: 'flexDirection',
scale: 'flexDirection',
},
// item
flex: true,
Expand Down

1 comment on commit 5c52b85

@vercel
Copy link

@vercel vercel bot commented on 5c52b85 Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.