Skip to content

Commit 85127f7

Browse files
authored
Merge pull request #4912 from GeekyAnts/fix/platform-typing-3.3
Fix/platform typing 3.3
2 parents 44bee73 + f0ca38f commit 85127f7

File tree

10 files changed

+52
-14
lines changed

10 files changed

+52
-14
lines changed

example/storybook/stories/components/composites/Alert/knobEnabled.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Alert, Box, CloseIcon, IconButton } from 'native-base';
2+
import { Alert, Box, CloseIcon, IconButton, Text } from 'native-base';
33
import { select } from '@storybook/addon-knobs';
44

55
export const Example = () => {
@@ -21,8 +21,8 @@ export const Example = () => {
2121
actionProps={{ alignSelf: 'center' }}
2222
>
2323
<Alert.Icon />
24-
<Alert.Title>Error Alert</Alert.Title>
25-
<Alert.Description>Description </Alert.Description>
24+
<Text>Error Alert</Text>
25+
<Text>Description </Text>
2626
</Alert>
2727
</Box>
2828
);

src/components/basic/FlatList/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { StyledProps } from '../../../theme/types';
22
import type { FlatListProps } from 'react-native';
33
import type { CustomProps, PlatformProps } from '../../types';
4+
import type { MutableRefObject } from 'react';
45

56
export interface InterfaceFlatListProps<ItemT>
67
extends FlatListProps<ItemT>,
@@ -10,6 +11,7 @@ export interface InterfaceFlatListProps<ItemT>
1011
* pass props to contentContainerStyle, and this also resolved NB tokens.
1112
*/
1213
_contentContainerStyle?: Partial<IFlatListProps<ItemT>>;
14+
ref?: MutableRefObject<any>;
1315
}
1416

1517
export type IFlatListProps<ItemT> = InterfaceFlatListProps<ItemT> &

src/components/basic/SectionList/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import type { StyledProps } from '../../../theme/types';
22
import type { SectionListProps } from 'react-native';
33
import type { CustomProps, PlatformProps } from '../../types';
4+
import type { MutableRefObject } from 'react';
45
type DefaultSectionT = {
56
[key: string]: any;
67
};
78
// TODO: any need to fixed
89
export interface InterfaceSectionListProps<ItemT, sectionT = DefaultSectionT>
910
extends SectionListProps<ItemT, sectionT>,
1011
StyledProps,
11-
PlatformProps<ISectionListProps<ItemT, sectionT>> {}
12+
PlatformProps<ISectionListProps<ItemT, sectionT>> {
13+
ref?: MutableRefObject<any>;
14+
}
1215

1316
export type ISectionListProps<
1417
ItemT,

src/components/composites/AlertDialog/AlertDialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const AlertDialog = (
6868
onRequestClose={handleClose}
6969
isKeyboardDismissable={isKeyboardDismissable}
7070
useRNModalOnAndroid
71+
unmountOnExit
7172
>
7273
<AlertDialogContext.Provider
7374
value={{

src/components/composites/AlertDialog/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import type { IBoxProps } from '../../primitives/Box';
1+
import type { IBoxProps, InterfaceBoxProps } from '../../primitives/Box';
22
import type { IIconButtonProps } from '../IconButton';
33
import type { MutableRefObject } from 'react';
44
import type { CustomProps } from '../../../components/types/utils';
55

6-
export interface InterfaceAlertDialogProps extends IBoxProps {
6+
export interface InterfaceAlertDialogProps
7+
extends InterfaceBoxProps<IAlertDialogProps> {
78
/**
89
* If true, the AlertDialog will open. Useful for controllable state behaviour
910
*/

src/components/composites/IconButton/types.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import type { InterfacePressableProps } from '../../primitives/Pressable/types';
22
import type { IIconProps } from '../../primitives/Icon';
33
import type { CustomProps, ResponsiveValue, VariantType } from '../../types';
44
import type { ISizes } from '../../../theme/base/sizes';
5+
import type { PlatformProps } from '../../../components/types';
56

67
export interface InterfaceIconButtonProps
7-
extends Omit<InterfacePressableProps, 'children' | 'color'>,
8+
extends Omit<
9+
InterfacePressableProps,
10+
'children' | 'color' | '_light' | '_dark' | '_web' | '_android' | '_ios'
11+
>,
812
Omit<
913
IIconProps,
1014
| 'delayLongPress'
@@ -21,7 +25,8 @@ export interface InterfaceIconButtonProps
2125
| '_web'
2226
| '_android'
2327
| '_ios'
24-
> {
28+
>,
29+
PlatformProps<IIconButtonProps> {
2530
/**
2631
* The color of the radio when it's checked. This should be one of the color keys in the theme (e.g."green", "red").
2732
* @default 'primary'

src/components/primitives/Icon/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { CustomProps, ThemeComponentSizeType } from '../../types/utils';
1010
export interface InterfaceIconProps
1111
extends Omit<
1212
SvgProps,
13-
'opacity' | 'fill' | 'stroke' | 'height' | 'width' | 'transform' | 'color'
13+
'opacity' | 'stroke' | 'height' | 'width' | 'transform' | 'color'
1414
>,
1515
StyledProps,
1616
PlatformProps<IIconProps> {

src/components/primitives/Input/types.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ import type { InterfaceBoxProps } from '../Box';
55
import type { ResponsiveValue } from '../../../components/types';
66
import type { ISizes } from '../../../theme/base/sizes';
77
import type {
8+
ColorType,
89
CustomProps,
910
ThemeComponentSizeType,
1011
VariantType,
1112
} from '../../../components/types/utils';
1213
// import type { MutableRefObject } from 'react';
14+
import type { IStackProps } from '../Stack/Stack';
15+
import type { MutableRefObject } from 'react';
1316

1417
export interface InterfaceInputProps
15-
extends PlatformProps<any>,
18+
extends PlatformProps<IInputProps>,
1619
Omit<TextInputProps, 'textAlign'>,
1720
StyledProps {
1821
/**
@@ -98,9 +101,24 @@ export interface InterfaceInputProps
98101
* Passed props will be applied on invalid state.
99102
*/
100103
_invalid?: Partial<IInputProps>;
101-
// These porps are currently on hold
102-
// label?: string;
103-
// _label?: ITextProps;
104+
/**
105+
* props are passed to InputBase component
106+
*/
107+
_input?: Partial<IInputProps>;
108+
/**
109+
* Props to be passed to the Stack used inside.
110+
*/
111+
_stack?: Partial<IStackProps>;
112+
/**
113+
* This prop allow you to change outlineColor when input is in focused state
114+
*/
115+
focusOutlineColor?: ColorType;
116+
/**
117+
* This prop allow you to change outlineColor when input is in focused state
118+
*/
119+
inValidOutlineColor?: ColorType;
120+
121+
ref?: MutableRefObject<any>;
104122
}
105123

106124
export interface IInputGroupProps extends InterfaceBoxProps<IInputGroupProps> {

src/components/primitives/Radio/types.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ export interface InterfaceRadioProps extends InterfaceBoxProps<IRadioProps> {
100100
* You can style interaction box around the checkbox using this.
101101
*/
102102
_interactionBox?: Omit<Partial<IRadioProps>, '_interactionBox'>;
103+
104+
ref?: MutableRefObject<any>;
103105
}
104106
export interface IRadioGroupProps extends IBoxProps<IRadioGroupProps> {
105107
/**

src/components/primitives/TextArea/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { Input } from '../Input';
33
import type { InterfaceInputProps } from '../Input/types';
44
import { usePropsResolution } from '../../../hooks/useThemeProps';
55
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
6-
export interface ITextAreaProps extends InterfaceInputProps {
6+
import type { PlatformProps } from '../../../components/types';
7+
export interface ITextAreaProps
8+
extends Omit<
9+
InterfaceInputProps,
10+
'_web' | '_android' | '_ios' | '_light' | '_dark'
11+
>,
12+
PlatformProps<ITextAreaProps> {
713
/**
814
* Maps to react-native TextInput's numberOfLines.
915
*/

0 commit comments

Comments
 (0)