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 Property 'theme' is missing #3732

Closed
younes0 opened this issue Mar 7, 2023 · 0 comments · Fixed by #3735
Closed

typescript error Property 'theme' is missing #3732

younes0 opened this issue Mar 7, 2023 · 0 comments · Fixed by #3735

Comments

@younes0
Copy link

younes0 commented Mar 7, 2023

Current behaviour

As reported and explained here: microsoft/rnx-kit#2247 (comment)

src/App.native.tsx:196:12 - error TS2741: Property 'theme' is missing in type '{ icon: string; size: number; onPress: () => void; }' but required in type 'Pick<Props, "testID" | "disabled" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 72 more ... | "size">'.

196           <IconButton
               ~~~~~~~~~~

  ../../node_modules/react-native-paper/lib/typescript/components/TouchableRipple/TouchableRipple.native.d.ts:13:5
    13     theme: InternalTheme;
           ~~~~~
    'theme' is declared here.


Found 1 error in src/App.native.tsx:196

Expected behaviour

No typescript errors

How to reproduce?

Add "moduleSuffixes": [".android", ".native", ""] to tsconfig

What have you tried so far?

replace content of TouchableRipple.native.tsx

type Props = React.ComponentProps<typeof Pressable> & {
  ...
  children: React.ReactNode;
  style?: StyleProp<ViewStyle>;
  theme: InternalTheme;
};

by TouchableRipple.tsx content, where theme is optional

export type Props = React.ComponentPropsWithRef<typeof Pressable> & {
  ...
  children: React.ReactNode;
  style?: StyleProp<ViewStyle>;
  theme?: ThemeProp;
};

Your Environment

software version
react-native 0.71.3
react-native-paper 5.3.1
node 16.17.0
expo sdk 48.0.0
typescript 4.9.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants