Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

TypeScript error with FlashListProps #887

Closed
2 tasks done
TNAJanssen opened this issue Jul 27, 2023 · 3 comments
Closed
2 tasks done

TypeScript error with FlashListProps #887

TNAJanssen opened this issue Jul 27, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@TNAJanssen
Copy link

Current behavior

Gives an TypeScript error:
TS2430: Interface  FlashListProps  incorrectly extends interface  ScrollViewProps 
Types of property  contentContainerStyle  are incompatible.
Type  ContentStyle | undefined  is not assignable to type  StyleProp 
Type  ContentStyle  is not assignable to type  StyleProp 
Type  ContentStyle  is not assignable to type  ViewStyle 
Types of property  padding  are incompatible.
Type  string | number | undefined  is not assignable to type  DimensionValue | undefined 
Type  string  is not assignable to type  DimensionValue | undefined 

Expected behavior

Should not give an error

To Reproduce

Install and run TypeScript check

Platform:

  • iOS
  • Android

Environment

1.5.0

@TNAJanssen TNAJanssen added the bug Something isn't working label Jul 27, 2023
@eightyfive
Copy link

I get another TS error when passing an array to contentContainerStyle:

Type 'ViewStyle[]' is not assignable to type 'ContentStyle | AnimatedNode<ContentStyle | undefined> | undefined'.

@uhrohraggy
Copy link

Can you release a patch for this?

It's mostly a simple update from

export interface ContentStyle {
  backgroundColor?: ColorValue;
  paddingTop?: string | number;
  paddingLeft?: string | number;
  paddingRight?: string | number;
  paddingBottom?: string | number;
  padding?: string | number;
  paddingVertical?: string | number;
  paddingHorizontal?: string | number;
}

to

import {
   ...
  DimensionValue,
} from "react-native";
...
export interface ContentStyle {
  backgroundColor?: ColorValue;
  paddingTop?: DimensionValue;
  paddingLeft?: DimensionValue;
  paddingRight?: DimensionValue;
  paddingBottom?: DimensionValue;
  padding?: DimensionValue;
  paddingVertical?: DimensionValue;
  paddingHorizontal?: DimensionValue;
}

React Native version is "0.72.4"

@naqvitalha
Copy link
Collaborator

This should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants