Skip to content

Commit eca16e7

Browse files
committed
fix: 🏷️ add as ReactNode to RenderPropType of children
fixing type not assignable to type 'ReactNode' error
1 parent 9fdc110 commit eca16e7

File tree

7 files changed

+17
-14
lines changed

7 files changed

+17
-14
lines changed

src/components/badge/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const RNBadge: React.FC<Partial<BadgeProps>> = forwardRef<
7676
})
7777
) : (
7878
<Box style={tailwind.style(cx(badgeStyles.size[size]?.prefix))}>
79-
{prefix}
79+
{prefix as React.ReactNode}
8080
</Box>
8181
);
8282

src/components/button/ButtonSpinner.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { isValidElement } from "react";
33
import { Box } from "../../primitives";
44
import { useTheme } from "../../theme";
55
import { cx } from "../../utils";
6-
import { Spinner } from "../spinner";
6+
import { Spinner, SpinnerSizes } from "../spinner";
77

88
import { ButtonProps } from "./Button";
99

@@ -50,10 +50,11 @@ export const ButtonSpinner: React.FC<ButtonSpinnerProps> = ({
5050
const tailwind = useTheme();
5151
const buttonTheme = useTheme("button");
5252

53-
const spinnerSize =
53+
const spinnerSize = (
5454
prefix || suffix
5555
? spinnerSizes[size]?.spinner
56-
: spinnerSizes[size]?.iconOnly;
56+
: spinnerSizes[size]?.iconOnly
57+
) as SpinnerSizes;
5758

5859
return isValidElement(spinner) ? (
5960
React.cloneElement(spinner, {

src/components/select/SelectPrefix.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const SelectPrefix: React.FC<SelectPrefixProps> = ({
6464
)}
6565
{...props}
6666
>
67-
{_prefix}
67+
{_prefix as React.ReactNode}
6868
</Box>
6969
);
7070
};

src/components/select/SelectSuffix.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const SelectSuffix: React.FC<SelectSuffixProps> = ({
5252
iconFill: tailwind.getColor(iconColor),
5353
})
5454
: suffix;
55-
return selectSuffix;
55+
return selectSuffix as React.ReactNode;
5656
// eslint-disable-next-line react-hooks/exhaustive-deps
5757
}, [disabled, invalid, suffix, isPressedOrHovered]);
5858

src/components/slider/SliderTooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const RNSliderTooltip: React.FC<Partial<SliderTooltipProps>> = props => {
118118
getContainerStyle,
119119
]}
120120
>
121-
{content}
121+
{content as React.ReactNode}
122122
</Box>
123123
<AnimatedBox
124124
style={[

src/components/tag/Tag.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const RNTag: React.FC<Partial<TagProps>> = forwardRef<
111111
})
112112
) : (
113113
<Box style={tailwind.style(cx(tagTheme.size[size]?.prefix))}>
114-
{prefix}
114+
{prefix as React.ReactNode}
115115
</Box>
116116
));
117117

@@ -138,7 +138,7 @@ const RNTag: React.FC<Partial<TagProps>> = forwardRef<
138138
})
139139
) : (
140140
<Box style={tailwind.style(cx(tagTheme.size[size]?.suffix))}>
141-
{suffix}
141+
{suffix as React.ReactNode}
142142
</Box>
143143
));
144144

@@ -163,7 +163,7 @@ const RNTag: React.FC<Partial<TagProps>> = forwardRef<
163163
adjustsFontSizeToFit
164164
allowFontScaling={false}
165165
>
166-
{props.children}
166+
{props.children as React.ReactNode}
167167
</Text>
168168
) : (
169169
props.children
@@ -222,9 +222,11 @@ const RNTag: React.FC<Partial<TagProps>> = forwardRef<
222222
accessibilityRole="button"
223223
accessibilityLabel={accesibilityLabel}
224224
>
225-
{_prefix}
226-
{children}
227-
{_suffix}
225+
<>
226+
{_prefix}
227+
{children}
228+
{_suffix}
229+
</>
228230
</Touchable>
229231
);
230232
});

src/components/tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const RNTooltip: React.FC<Partial<TooltipProps>> = props => {
107107
{content}
108108
</Text>
109109
) : (
110-
content
110+
(content as React.ReactNode)
111111
)}
112112
</Box>
113113
</Popover.Content>

0 commit comments

Comments
 (0)