Skip to content

Commit 420ade4

Browse files
committed
fix: ref typing actionsheet accordion button
1 parent bb4a29a commit 420ade4

File tree

5 files changed

+51
-28
lines changed

5 files changed

+51
-28
lines changed

example/storybook/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"baseUrl": ".",
55
"paths": {
66
"@gluestack-ui/themed": ["../../packages/themed/src"],
7+
"@gluestack-ui/button": ["../../packages/unstyled/button/src"],
78
"@gluestack-ui/config": ["../../packages/config/src/gluestack-ui.config"],
89
"react-native": ["./node_modules/react-native-web"],
910
"@gluestack-style/react": ["../../packages/styled/react/src"],

packages/unstyled/accordion/src/types.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import type { ViewProps } from 'react-native';
23

34
export interface IAccordionProps extends ViewProps {
@@ -91,27 +92,33 @@ export type IAccordionComponentType<
9192
TitleTextProps,
9293
ContentTextProps
9394
> = React.ForwardRefExoticComponent<
94-
AccordionProps & React.RefAttributes<AccordionProps> & IAccordionProps
95+
React.PropsWithoutRef<AccordionProps & IAccordionProps> &
96+
React.RefAttributes<AccordionProps>
9597
> & {
9698
Item: React.ForwardRefExoticComponent<
97-
ItemProps & React.RefAttributes<ItemProps> & IAccordionItemProps
99+
React.PropsWithoutRef<ItemProps & IAccordionItemProps> &
100+
React.RefAttributes<ItemProps>
98101
>;
99102
Header: React.ForwardRefExoticComponent<
100-
HeaderProps & React.RefAttributes<HeaderProps>
103+
React.PropsWithoutRef<HeaderProps> & React.RefAttributes<HeaderProps>
101104
>;
102105
Trigger: React.ForwardRefExoticComponent<
103-
Omit<TriggerProps, 'children'> & IAccordionTriggerProps
106+
React.PropsWithoutRef<
107+
Omit<TriggerProps, 'children'> & IAccordionTriggerProps
108+
> &
109+
React.RefAttributes<TriggerProps>
104110
>;
105111
Content: React.ForwardRefExoticComponent<
106-
ContentProps & React.RefAttributes<ContentProps>
112+
React.PropsWithoutRef<ContentProps> & React.RefAttributes<ContentProps>
107113
>;
108114
TitleText: React.ForwardRefExoticComponent<
109-
TitleTextProps & React.RefAttributes<TitleTextProps>
115+
React.PropsWithoutRef<TitleTextProps> & React.RefAttributes<TitleTextProps>
110116
>;
111117
ContentText: React.ForwardRefExoticComponent<
112-
ContentTextProps & React.RefAttributes<ContentTextProps>
118+
React.PropsWithoutRef<ContentTextProps> &
119+
React.RefAttributes<ContentTextProps>
113120
>;
114121
Icon: React.ForwardRefExoticComponent<
115-
IconProps & React.RefAttributes<IconProps>
122+
React.PropsWithoutRef<IconProps> & React.RefAttributes<IconProps>
116123
>;
117124
};

packages/unstyled/actionsheet/src/types.ts

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,45 +66,52 @@ export type IActionsheetComponentType<
6666
SectionHeaderTextProps,
6767
IconProps
6868
> = React.ForwardRefExoticComponent<
69-
ActionsheetProps & React.RefAttributes<ActionsheetProps> & IActionsheetProps
69+
React.RefAttributes<ActionsheetProps> &
70+
React.PropsWithoutRef<ActionsheetProps & IActionsheetProps>
7071
> & {
7172
Content: React.ForwardRefExoticComponent<
72-
ContentProps &
73-
React.RefAttributes<ContentProps> &
74-
InterfaceActionsheetContentProps
73+
React.PropsWithoutRef<ContentProps & InterfaceActionsheetContentProps> &
74+
React.RefAttributes<ContentProps>
7575
>;
7676
Item: React.ForwardRefExoticComponent<
77-
ItemProps & InterfaceActionsheetItemProps & React.RefAttributes<ItemProps>
77+
React.PropsWithoutRef<ItemProps & InterfaceActionsheetItemProps> &
78+
React.RefAttributes<ItemProps>
7879
>;
7980
ItemText: React.ForwardRefExoticComponent<
80-
React.RefAttributes<ItemTextProps> & ItemTextProps
81+
React.RefAttributes<ItemTextProps> & React.PropsWithoutRef<ItemTextProps>
8182
>;
8283
DragIndicator: React.ForwardRefExoticComponent<
83-
React.RefAttributes<DragIndicatorProps> & DragIndicatorProps
84+
React.RefAttributes<DragIndicatorProps> &
85+
React.PropsWithoutRef<DragIndicatorProps>
8486
>;
8587
Backdrop: React.ForwardRefExoticComponent<
86-
React.RefAttributes<BackdropProps> & BackdropProps
88+
React.RefAttributes<BackdropProps> & React.PropsWithoutRef<BackdropProps>
8789
>;
8890
DragIndicatorWrapper: React.ForwardRefExoticComponent<
89-
React.RefAttributes<IndicatorWrapperProps> & IndicatorWrapperProps
91+
React.RefAttributes<IndicatorWrapperProps> &
92+
React.PropsWithoutRef<IndicatorWrapperProps>
9093
>;
9194
ScrollView: React.ForwardRefExoticComponent<
92-
React.RefAttributes<ScrollViewProps> & ScrollViewProps
95+
React.RefAttributes<ScrollViewProps> &
96+
React.PropsWithoutRef<ScrollViewProps>
9397
>;
9498
VirtualizedList: React.ForwardRefExoticComponent<
95-
React.RefAttributes<VirtualizedListProps> & VirtualizedListProps
99+
React.RefAttributes<VirtualizedListProps> &
100+
React.PropsWithoutRef<VirtualizedListProps>
96101
>;
97102
FlatList: React.ForwardRefExoticComponent<
98-
React.RefAttributes<FlatListProps> & FlatListProps
103+
React.RefAttributes<FlatListProps> & React.PropsWithoutRef<FlatListProps>
99104
>;
100105
SectionList: React.ForwardRefExoticComponent<
101-
React.RefAttributes<SectionListProps> & SectionListProps
106+
React.RefAttributes<SectionListProps> &
107+
React.PropsWithoutRef<SectionListProps>
102108
>;
103109
SectionHeaderText: React.ForwardRefExoticComponent<
104-
React.RefAttributes<SectionHeaderTextProps> & SectionHeaderTextProps
110+
React.RefAttributes<SectionHeaderTextProps> &
111+
React.PropsWithoutRef<SectionHeaderTextProps>
105112
>;
106113
Icon: React.ForwardRefExoticComponent<
107-
React.RefAttributes<IconProps> & IconProps
114+
React.RefAttributes<IconProps> & React.PropsWithoutRef<IconProps>
108115
>;
109116
};
110117

packages/unstyled/button/src/types.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { PropsWithoutRef, RefAttributes } from 'react';
12
import type { PressableProps } from 'react-native';
23

34
export interface InterfaceButtonProps extends PressableProps {
@@ -53,19 +54,19 @@ export type IButtonComponentType<
5354
TextProps,
5455
IconProps
5556
> = React.ForwardRefExoticComponent<
56-
React.RefAttributes<ButtonProps> & ButtonProps & IButtonProps
57+
PropsWithoutRef<ButtonProps & IButtonProps> & RefAttributes<ButtonProps>
5758
> & {
5859
Group: React.ForwardRefExoticComponent<
59-
React.RefAttributes<GroupProps> & GroupProps & IButtonGroupProps
60+
RefAttributes<GroupProps> & PropsWithoutRef<GroupProps & IButtonGroupProps>
6061
>;
6162
Spinner: React.ForwardRefExoticComponent<
62-
SpinnerProps & React.RefAttributes<SpinnerProps>
63+
PropsWithoutRef<SpinnerProps> & React.RefAttributes<SpinnerProps>
6364
>;
6465
Text: React.ForwardRefExoticComponent<
65-
React.RefAttributes<TextProps> & TextProps
66+
React.RefAttributes<TextProps> & PropsWithoutRef<TextProps>
6667
>;
6768
Icon: React.ForwardRefExoticComponent<
68-
React.RefAttributes<IconProps> & IconProps
69+
React.RefAttributes<IconProps> & PropsWithoutRef<IconProps>
6970
>;
7071
};
7172

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,6 +2631,13 @@
26312631
"@gluestack-ui/utils" "^0.1.12"
26322632
"@react-native-aria/focus" "^0.2.9"
26332633

2634+
"@gluestack-ui/utils@0.1.12":
2635+
version "0.1.12"
2636+
resolved "https://registry.yarnpkg.com/@gluestack-ui/utils/-/utils-0.1.12.tgz#0bb3400c9315fb6c0fd1bc697b20d80f82cd3899"
2637+
integrity sha512-OhOkljhr7foCUJP//8LwMN3EX4/pniFWmQpk1yDJMQL9DaTJbP7s3HsnTM7UzH2kp9DR1Utoz9Y9WscH3ajLpQ==
2638+
dependencies:
2639+
"@react-native-aria/focus" "^0.2.9"
2640+
26342641
"@gluestack/design-system@0.5.36":
26352642
version "0.5.36"
26362643
resolved "https://registry.yarnpkg.com/@gluestack/design-system/-/design-system-0.5.36.tgz#ee9c6a1dc3d0806eda5bd5781b58c3e8b3621dcf"

0 commit comments

Comments
 (0)