Skip to content

Commit

Permalink
fix typescript problem
Browse files Browse the repository at this point in the history
  • Loading branch information
sieu-db committed Dec 4, 2024
1 parent b2df93a commit 3a478ba
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
StyleSheet,
TextStyle,
ActivityIndicator,
ViewStyle,
} from "react-native";
import { withTheme } from "@draftbit/theme";
import type { ReadTheme } from "@draftbit/theme";
Expand Down Expand Up @@ -111,7 +112,7 @@ function Base({
{
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
},
buttonStyles,
buttonStyles as ViewStyle,
];
}}
{...props}
Expand Down Expand Up @@ -150,7 +151,7 @@ const Solid = ({ style, theme, ...props }: Props): JSX.Element => {
borderRadius: 8,
backgroundColor: theme.colors.branding.primary,
},
style,
style as ViewStyle,
]}
{...props}
/>
Expand All @@ -177,7 +178,7 @@ const Outline = ({ style, theme, ...props }: Props): JSX.Element => {
//@ts-ignore
color: theme.colors.branding.primary,
},
style,
style as ViewStyle,
]}
{...props}
/>
Expand Down
17 changes: 11 additions & 6 deletions packages/core/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
);

if (inline) {
return <View style={style}>{Picker}</View>;
return <View style={style as StyleProp<ViewStyle>}>{Picker}</View>;
}

return (
Expand All @@ -435,7 +435,10 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
])}
>
{leftIconName && leftIconMode === "outset" ? (
<Icon {...leftIconProps} style={leftIconStyle} />
<Icon
{...leftIconProps}
style={leftIconStyle as ImageStyle & ViewStyle}
/>
) : null}
<View
style={StyleSheet.flatten([
Expand Down Expand Up @@ -520,10 +523,12 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
{leftIconName && leftIconMode === "inset" ? (
<Icon
{...leftIconProps}
style={{
...leftIconStyle,
marginLeft: type === "solid" ? 16 : 0,
}}
style={
{
...leftIconStyle,
marginLeft: type === "solid" ? 16 : 0,
} as ImageStyle & ViewStyle
}
/>
) : null}

Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
StyleSheet,
ImageSourcePropType,
DimensionValue,
StyleProp,
ViewStyle,
} from "react-native";
import Config from "./Config";

Expand Down Expand Up @@ -70,7 +72,9 @@ const Image: React.FC<ImageProps> = ({

if (aspectRatio) {
return (
<AspectRatio style={[style, { width, height, aspectRatio }]}>
<AspectRatio
style={[style, { width, height, aspectRatio }] as StyleProp<ViewStyle>}
>
<NativeImage
{...props}
source={imageSource as ImageSourcePropType}
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/components/Picker/PickerInputContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from "react";
import { View, StyleSheet } from "react-native";
import {
View,
StyleSheet,
StyleProp,
ViewStyle,
TextStyle,
} from "react-native";
import omit from "lodash.omit";
import {
extractPositionStyles,
Expand Down Expand Up @@ -72,7 +78,7 @@ const PickerInputContainer: React.FC<
value={selectedLabel?.toString()}
editable={false}
disabled={disabled}
style={textFieldStyle}
style={textFieldStyle as StyleProp<ViewStyle & TextStyle>}
{...rest}
/>
<Touchable
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/PinInput/PinInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface CellItem {
isFocused: boolean;
}

interface PinInputProps extends TextInputProps {
interface PinInputProps extends Omit<TextInputProps, "style"> {
onInputFull?: (value: string) => void;
cellCount?: number;
clearOnCellFocus?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/SVG.native.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { View, StyleProp, ImageStyle } from "react-native";
import { View, StyleProp, ViewStyle, ImageStyle } from "react-native";
import { SvgUri } from "react-native-svg";

import Config from "./Config";
Expand All @@ -14,7 +14,7 @@ const SVG: React.FC<React.PropsWithChildren<SVGComponentProps>> = ({
style,
}) => {
return (
<View style={style}>
<View style={style as StyleProp<ViewStyle>}>
<SvgUri width="100%" height="100%" uri={source} />
</View>
);
Expand Down

0 comments on commit 3a478ba

Please sign in to comment.