Skip to content

Commit 691806c

Browse files
authored
Merge pull request #5458 from GeekyAnts/release/3.4.18
Release/3.4.18
2 parents 4e7d078 + 72ed66c commit 691806c

35 files changed

+430
-280
lines changed

example/storybook/stories/hooks/useAccessibleColors/Basic.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const Example = () => {
4242
</Stack>
4343
<HStack mt="6" space="3">
4444
<Text>Toggle Accessible Colors</Text>
45-
<Switch onToggle={toggleAccessibleColors} colorScheme="coolGray" />
45+
<Switch onValueChange={toggleAccessibleColors} colorScheme="coolGray" />
4646
</HStack>
4747
</Center>
4848
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { useSx } from 'native-base';
3+
import type { StyledProps } from 'native-base';
4+
import { View, Text } from 'react-native';
5+
6+
const textStyle: StyledProps = {
7+
color: ['orange.900', 'white', 'black'],
8+
textAlign: 'center',
9+
size: '12',
10+
};
11+
12+
export const Example = () => {
13+
const sx = useSx();
14+
console.log('Size', sx(textStyle));
15+
return (
16+
<View
17+
style={[
18+
sx({
19+
p: 2,
20+
bg: ['blue.300', 'violet.400', 'red.400'],
21+
width: 48,
22+
height: 48,
23+
}),
24+
{ justifyContent: 'center', alignItems: 'center' },
25+
]}
26+
>
27+
<Text style={sx(textStyle)}>New Feat useSx in NativeBase</Text>
28+
</View>
29+
);
30+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import { storiesOf } from '@storybook/react-native';
3+
import { withKnobs } from '@storybook/addon-knobs';
4+
import Wrapper from '../../components/Wrapper';
5+
import { Example as Basic } from './Basic';
6+
7+
storiesOf('useSx', module)
8+
.addDecorator(withKnobs)
9+
.addDecorator((getStory: any) => <Wrapper>{getStory()}</Wrapper>)
10+
.add('Basic', () => <Basic />);

example/storybook/stories/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export * from './hooks/useMediaQuery';
8686
export * from './hooks/useSafeArea';
8787
export * from './hooks/useContrastText';
8888
export * from './hooks/useAccessibleColors';
89-
89+
export * from './hooks/useSx';
9090
// // Theme
9191
export * from './theme/Custom';
9292
export * from './theme/Mode';

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"prettier --write"
3737
]
3838
},
39-
"version": "3.4.17",
39+
"version": "3.4.18",
4040
"license": "MIT",
4141
"private": false,
4242
"main": "lib/commonjs/index",

src/components/basic/ScrollView/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface InterfaceScrollViewProps
1010
* Renders components as Box children. Accepts a JSX.Element or an array of JSX.Element. */
1111
children?: JSX.Element | JSX.Element[] | string | any;
1212
/**
13-
* pass props to contentContainerStyle, and this also resolved NB tokens.
13+
* Pass props to contentContainerStyle, and this also resolves NB tokens.
1414
*/
1515
_contentContainerStyle?: Partial<IScrollViewProps>;
1616
}

src/components/composites/Actionsheet/types.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import type { CustomProps } from '../../../components/types';
66
export interface InterfaceActionsheetProps
77
extends InterfaceBoxProps<IActionsheetProps> {
88
/**
9-
* If true, the ActionSheet will open. Useful for controllable state behaviour
9+
* If true, the ActionSheet will open. Useful for controllable state behavior.
1010
*/
1111
isOpen?: boolean;
1212
/**
13-
* Callback invoked when the modal is closed
13+
* Callback invoked when the modal is closed.
1414
*/
1515
onClose?: () => any;
1616
/**
@@ -36,15 +36,15 @@ export interface InterfaceActionsheetProps
3636
export interface IActionsheetContentProps
3737
extends InterfaceBoxProps<IActionsheetContentProps> {
3838
/**
39-
* Props applied on area above actionsheet content
39+
* Props applied on area above actionsheet content.
4040
*/
4141
_dragIndicatorWrapperOffSet?: InterfaceBoxProps<IActionsheetContentProps>;
4242
/**
43-
* Props applied on area around drag indicator
43+
* Props applied on area around drag indicator.
4444
*/
4545
_dragIndicatorWrapper?: InterfaceBoxProps<IActionsheetContentProps>;
4646
/**
47-
* Props applied on drag indicator
47+
* Props applied on drag indicator.
4848
*/
4949
_dragIndicator?: InterfaceBoxProps<IActionsheetContentProps>;
5050
}

src/components/composites/Alert/types.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface InterfaceAlertProps extends InterfaceBoxProps<IAlertProps> {
1313
*/
1414
variant?: VariantType<'Alert'>;
1515

16-
/** The colorScheme of the Alert.
16+
/** The color scheme of the Alert.
1717
*/
1818
colorScheme?: ColorSchemeType;
1919
}

src/components/composites/Avatar/types.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ export interface InterfaceAvatarProps extends InterfaceBoxProps<IAvatarProps> {
1010
*/
1111
source?: ImageSourcePropType;
1212
/**
13-
* The size of the avatar
13+
* The size of the avatar.
1414
* @default md
1515
*/
1616
size?: ThemeComponentSizeType<'Avatar'>;
1717
/**
18-
* For providing props to Image component inside Avatar
18+
* For providing props to Image component inside the Avatar.
1919
*/
2020
_image?: Partial<IImageProps>;
2121
/**
22-
* ref to be attached to Avatar wrapper
22+
* ref to be attached to the Avatar wrapper.
2323
*/
2424
wrapperRef?: MutableRefObject<any>;
2525
}

src/components/composites/Fab/types.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ import type { InterfaceButtonProps } from '../../primitives/Button/types';
33

44
export interface InterfaceFabProps extends InterfaceButtonProps {
55
/**
6-
* Placement of the Fab
6+
* Placement of the Fab.
77
* @default bottom-right
88
*/
99
placement?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
1010
/**
11-
* Text to be displayed in Fab
11+
* Text to be displayed in Fab.
1212
*/
1313
label?: JSX.Element | string;
1414
/**
15-
* Icon to be displayed in Fab
15+
* Icon to be displayed in Fab.
1616
*/
1717
icon?: JSX.Element;
1818
/**
1919
* Determines whether the Fab should be rendered in a Portal.
20-
* Refer this solution before using this prop
20+
* Refer to this solution before using this prop-
2121
* https://github.com/GeekyAnts/NativeBase/issues/3817
2222
* @default true
2323
*/

src/components/composites/IconButton/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const IconButton = (
6363

6464
return (
6565
<Pressable
66+
disabled={isDisabled}
6667
accessibilityRole="button"
6768
ref={ref}
6869
onPressIn={composeEventHandlers(onPressIn, pressableProps.onPressIn)}

src/components/composites/Menu/types.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ import type { CustomProps } from '../../../components/types';
1010

1111
export interface InterfaceMenuProps extends InterfaceBoxProps<IMenuProps> {
1212
/**
13-
* Function that returns a React Element. This element will be used as a Trigger for the menu
13+
* Function that returns a React Element. This element will be used as a Trigger for the menu.
1414
*/
1515
trigger: (_props: any, state: { open: boolean }) => JSX.Element;
1616
/**
17-
* This function will be invoked when menu is opened
17+
* This function will be invoked when the menu is opened.
1818
*/
1919
onOpen?: () => void;
2020
/**
21-
* This function will be invoked when menu is closed. It'll also be called when user attempts to close the menu via Escape key or backdrop press.
21+
* This function will be invoked when menu is closed. It will also be called when the user attempts to close the menu via Escape key or backdrop press.
2222
*/
2323
onClose?: () => void;
2424
/**
25-
* Whether menu should be closed when a menu item is pressed
25+
* Whether menu should be closed when a menu item is pressed.
2626
* @default true
2727
*/
2828
closeOnSelect?: boolean;
2929
/**
30-
* If true, the menu will be opened by default
30+
* If true, the menu will be opened by default.
3131
*/
3232
defaultIsOpen?: boolean;
3333
/**
34-
* Whether the menu is opened. Useful for conrolling the open state
34+
* Whether the menu is opened. Useful for controlling the open state.
3535
*/
3636
isOpen?: boolean;
3737
/**
@@ -43,7 +43,7 @@ export interface InterfaceMenuProps extends InterfaceBoxProps<IMenuProps> {
4343
*/
4444
offset?: number;
4545
/**
46-
* Determines whether menu content should overlap with the trigger
46+
* Determines whether menu content should overlap with the trigger.
4747
* @default false
4848
*/
4949
shouldOverlapWithTrigger?: boolean;
@@ -85,19 +85,19 @@ export interface InterfaceMenuProps extends InterfaceBoxProps<IMenuProps> {
8585

8686
export interface IMenuItemProps extends IPressableProps {
8787
/**
88-
* Children of Menu Item
88+
* Children of Menu Item.
8989
*/
9090
children: string | JSX.Element | Array<JSX.Element>;
9191
/**
92-
* Whether menu item is disabled
92+
* Whether menu item is disabled.
9393
*/
9494
isDisabled?: boolean;
9595
/**
96-
* Props to be passed to Text
96+
* Props to be passed to Text.
9797
*/
9898
_text?: Partial<ITextProps>;
9999
/**
100-
* This value will be available for the typeahead menu feature
100+
* This value will be available for the typeahead menu feature.
101101
*/
102102
textValue?: string;
103103
}
@@ -122,11 +122,11 @@ export interface IMenuItemOptionProps extends IMenuItemProps {
122122
}
123123
export interface IMenuGroupProps {
124124
/**
125-
* The title of the menu group
125+
* The title of the menu group.
126126
*/
127127
title: string;
128128
/**
129-
* The children of Menu group
129+
* The children of the Menu group.
130130
*/
131131
children: JSX.Element | Array<JSX.Element>;
132132
/**
@@ -141,15 +141,15 @@ export interface IMenuOptionGroupProps extends IMenuGroupProps {
141141
*/
142142
type: 'radio' | 'checkbox';
143143
/**
144-
* The initial value of the option group
144+
* The initial value of the option group.
145145
*/
146146
defaultValue?: string | number | string[] | number[];
147147
/**
148-
* The value of the option group
148+
* The value of the option group.
149149
*/
150150
value?: string | number | Array<string> | Array<number>;
151151
/**
152-
* Function called when selection changes
152+
* Function called when selection changes.
153153
*/
154154
onChange?: (val: any) => void;
155155
}

src/components/composites/Modal/types.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import type { ThemeComponentSizeType } from '../../../components/types/utils';
88
import type { IOverlayProps } from '../../primitives/Overlay';
99
export interface InterfaceModalProps extends InterfaceBoxProps<IModalProps> {
1010
/**
11-
* If true, the modal will open. Useful for controllable state behaviour
11+
* If true, the modal will open. Useful for controllable state behavior.
1212
*/
1313
isOpen?: boolean;
1414
/**
15-
* Callback invoked when the modal is closed
15+
* Callback invoked when the modal is closed.
1616
*/
1717
onClose?: any;
1818
/**
19-
* If true, the modal will be opened by default
19+
* If true, the modal will be opened by default.
2020
*/
2121
defaultIsOpen?: boolean;
2222
/**
23-
* The size of the modal
23+
* The size of the modal.
2424
*/
2525
size?: ThemeComponentSizeType<'Modal'>;
2626
/**
@@ -37,22 +37,22 @@ export interface InterfaceModalProps extends InterfaceBoxProps<IModalProps> {
3737
*/
3838
avoidKeyboard?: boolean;
3939
/**
40-
* If true, the modal will close when the overlay is clicked
40+
* If true, the modal will close when the overlay is clicked.
4141
* @default true
4242
*/
4343
closeOnOverlayClick?: boolean;
4444
/**
45-
* If true, the modal will close when Escape key is pressed
45+
* If true, the modal will close when Escape key is pressed.
4646
* @default true
4747
*/
4848
isKeyboardDismissable?: boolean;
4949
/**
50-
* If true, a backdrop element is visible
50+
* If true, a backdrop element is visible.
5151
* @default true
5252
*/
5353
overlayVisible?: boolean;
5454
/**
55-
* If true, a backdrop element is visible
55+
* If true, a backdrop element is visible.
5656
* @default true
5757
*/
5858
backdropVisible?: boolean;
@@ -61,7 +61,7 @@ export interface InterfaceModalProps extends InterfaceBoxProps<IModalProps> {
6161
*/
6262
_backdrop?: any;
6363
/**
64-
* Sets the animation type
64+
* Sets the animation type.
6565
* @default "fade"
6666
*/
6767
animationPreset?: 'fade' | 'slide';

src/components/composites/Popover/types.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export type IArrowProps = {
2222

2323
export interface InterfacePopoverProps {
2424
/**
25-
* If true, the popover will be opened by default
25+
* If true, the popover will be opened by default.
2626
*/
2727
defaultIsOpen?: boolean;
2828
/**
29-
* Whether the popover is opened. Useful for conrolling the open state
29+
* Whether the popover is opened. Useful for controlling the open state.
3030
*/
3131
isOpen?: boolean;
3232
/**
@@ -48,7 +48,7 @@ export interface InterfacePopoverProps {
4848
*/
4949
finalFocusRef?: React.RefObject<any>;
5050
/**
51-
* Function that returns a React Element. This element will be used as a Trigger for the popover
51+
* Function that returns a React Element. This element will be used as a Trigger for the popover.
5252
*/
5353
trigger: (_props: any, state: { open: boolean }) => JSX.Element;
5454
/**
@@ -60,16 +60,16 @@ export interface InterfacePopoverProps {
6060
*/
6161
offset?: number;
6262
/**
63-
* Determines whether menu content should overlap with the trigger
63+
* Determines whether menu content should overlap with the trigger.
6464
* @default false
6565
*/
6666
shouldOverlapWithTrigger?: boolean;
6767
/**
68-
* Popover children
68+
* Popover children.
6969
*/
7070
children: React.ReactNode;
7171
/**
72-
* If true, the modal will close when Escape key is pressed
72+
* If true, the modal will close when Escape key is pressed.
7373
* @default true
7474
*/
7575
isKeyboardDismissable?: boolean;
@@ -95,7 +95,7 @@ export interface InterfacePopoverProps {
9595
*/
9696
onClose?: () => void;
9797
/**
98-
* This function will be invoked when popover is opened
98+
* This function will be invoked when popover is opened.
9999
*/
100100
onOpen?: () => void;
101101

0 commit comments

Comments
 (0)