Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Type errors from @draftbit/ui (and others in draftbit project) when bringing the screens into TS project. #957

Open
techiejd opened this issue Oct 22, 2024 · 0 comments

Comments

@techiejd
Copy link

Hi all,

For many of these, I did @ts-ignore.

When I copy the screens from my draftbit project into my local project (can't build it all on draftbit due to needing to run pod install), I like to change it to typescript. Now this works well most of the time (it's generally possible to deduce what types things are and there are not usually any clashes) but there are some issues:

export declare const Button: import("react").ForwardRefExoticComponent<{} & import("react").RefAttributes<any>>; is missing style, title, disable and icon.

for export declare const TextField: import("react").ForwardRefExoticComponent<Omit<{..., numberOfLines: number; is not optional.

export declare const Link: import("react").ForwardRefExoticComponent<{} & import("react").RefAttributes<any>>; is also missing style and title.

const [checkboxRowValue, setCheckboxRowValue] = React.useState(""); They're string instead of boolean. Maybe was supposed to use parseBoolean? (not @draftbit/ui type problem, but rather generated code problem)

For export declare const CheckboxRow: import("react").ForwardRefExoticComponent<Omit<{, the labelContainerStyle: import("react-native").StyleProp<import("react-native").ViewStyle>; is not optional.

For <Stack.Navigator screenOptions={({ navigation }) => ({ cardStyle: { flex: 1 }, headerBackImage: Platform.OS === "android" ? DefaultAndroidBackIcon : null, })} > it's better to return undefined than null. (not @draftbit/ui type problem, but rather generated code problem)

The linking in <NavigationContainer theme={{ ...DefaultTheme, colors: { ...DefaultTheme.colors, background: "#FFFFFF", }, }} linking={LinkingConfiguration} > has a completely different API than the one given by LinkingConfiguration (not @draftbit/ui type problem, but rather generated code and interfacing with outside API problem).

For some reason Palette repeats fields.
For example `error TS1117: An object literal cannot have multiple properties with the same name.

200 textPlaceholder: "rgb(136, 144, 153)",And you go look and there are twotextPlaceholder: "rgb(136, 144, 153)"`. (not @draftbit/ui type problem, but rather generated code problem)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant