Skip to content

Commit 3a478ba

Browse files
committed
fix typescript problem
1 parent b2df93a commit 3a478ba

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

packages/core/src/components/Button.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
StyleSheet,
88
TextStyle,
99
ActivityIndicator,
10+
ViewStyle,
1011
} from "react-native";
1112
import { withTheme } from "@draftbit/theme";
1213
import type { ReadTheme } from "@draftbit/theme";
@@ -111,7 +112,7 @@ function Base({
111112
{
112113
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
113114
},
114-
buttonStyles,
115+
buttonStyles as ViewStyle,
115116
];
116117
}}
117118
{...props}
@@ -150,7 +151,7 @@ const Solid = ({ style, theme, ...props }: Props): JSX.Element => {
150151
borderRadius: 8,
151152
backgroundColor: theme.colors.branding.primary,
152153
},
153-
style,
154+
style as ViewStyle,
154155
]}
155156
{...props}
156157
/>
@@ -177,7 +178,7 @@ const Outline = ({ style, theme, ...props }: Props): JSX.Element => {
177178
//@ts-ignore
178179
color: theme.colors.branding.primary,
179180
},
180-
style,
181+
style as ViewStyle,
181182
]}
182183
{...props}
183184
/>

packages/core/src/components/DatePicker/DatePicker.tsx

+11-6
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
417417
);
418418

419419
if (inline) {
420-
return <View style={style}>{Picker}</View>;
420+
return <View style={style as StyleProp<ViewStyle>}>{Picker}</View>;
421421
}
422422

423423
return (
@@ -435,7 +435,10 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
435435
])}
436436
>
437437
{leftIconName && leftIconMode === "outset" ? (
438-
<Icon {...leftIconProps} style={leftIconStyle} />
438+
<Icon
439+
{...leftIconProps}
440+
style={leftIconStyle as ImageStyle & ViewStyle}
441+
/>
439442
) : null}
440443
<View
441444
style={StyleSheet.flatten([
@@ -520,10 +523,12 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
520523
{leftIconName && leftIconMode === "inset" ? (
521524
<Icon
522525
{...leftIconProps}
523-
style={{
524-
...leftIconStyle,
525-
marginLeft: type === "solid" ? 16 : 0,
526-
}}
526+
style={
527+
{
528+
...leftIconStyle,
529+
marginLeft: type === "solid" ? 16 : 0,
530+
} as ImageStyle & ViewStyle
531+
}
527532
/>
528533
) : null}
529534

packages/core/src/components/Image.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
StyleSheet,
77
ImageSourcePropType,
88
DimensionValue,
9+
StyleProp,
10+
ViewStyle,
911
} from "react-native";
1012
import Config from "./Config";
1113

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

7173
if (aspectRatio) {
7274
return (
73-
<AspectRatio style={[style, { width, height, aspectRatio }]}>
75+
<AspectRatio
76+
style={[style, { width, height, aspectRatio }] as StyleProp<ViewStyle>}
77+
>
7478
<NativeImage
7579
{...props}
7680
source={imageSource as ImageSourcePropType}

packages/core/src/components/Picker/PickerInputContainer.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React from "react";
2-
import { View, StyleSheet } from "react-native";
2+
import {
3+
View,
4+
StyleSheet,
5+
StyleProp,
6+
ViewStyle,
7+
TextStyle,
8+
} from "react-native";
39
import omit from "lodash.omit";
410
import {
511
extractPositionStyles,
@@ -72,7 +78,7 @@ const PickerInputContainer: React.FC<
7278
value={selectedLabel?.toString()}
7379
editable={false}
7480
disabled={disabled}
75-
style={textFieldStyle}
81+
style={textFieldStyle as StyleProp<ViewStyle & TextStyle>}
7682
{...rest}
7783
/>
7884
<Touchable

packages/core/src/components/PinInput/PinInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface CellItem {
2424
isFocused: boolean;
2525
}
2626

27-
interface PinInputProps extends TextInputProps {
27+
interface PinInputProps extends Omit<TextInputProps, "style"> {
2828
onInputFull?: (value: string) => void;
2929
cellCount?: number;
3030
clearOnCellFocus?: boolean;

packages/core/src/components/SVG.native.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from "react";
2-
import { View, StyleProp, ImageStyle } from "react-native";
2+
import { View, StyleProp, ViewStyle, ImageStyle } from "react-native";
33
import { SvgUri } from "react-native-svg";
44

55
import Config from "./Config";
@@ -14,7 +14,7 @@ const SVG: React.FC<React.PropsWithChildren<SVGComponentProps>> = ({
1414
style,
1515
}) => {
1616
return (
17-
<View style={style}>
17+
<View style={style as StyleProp<ViewStyle>}>
1818
<SvgUri width="100%" height="100%" uri={source} />
1919
</View>
2020
);

0 commit comments

Comments
 (0)