0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

React Native Paperをimportしたときのオーバーロードエラー

Posted at

詰まった点

React-native-paperをimportして使おうとするとオーバーロードがないというエラー

{
	"resource": "/Users/hoge/Desktop/fuga/src/components/screens/MyPageScreen.tsx",
	"owner": "typescript",
	"code": "2769",
	"severity": 8,
	"message": "この呼び出しに一致するオーバーロードはありません。\n  2 中 1 のオーバーロード, '(props: Pick<Props, \"ref\" | \"style\" | \"removeClippedSubviews\" | \"hitSlop\" | \"onLayout\" | \"pointerEvents\" | \"testID\" | \"nativeID\" | \"collapsable\" | \"needsOffscreenAlphaCompositing\" | ... 49 more ... | \"elevation\"> & { ...; }, context?: any): ReactElement<...> | ... 1 more ... | null' により、次のエラーが発生しました。\n    型 '{ children: Element; }' には 型 'Pick<Props, \"ref\" | \"style\" | \"removeClippedSubviews\" | \"hitSlop\" | \"onLayout\" | \"pointerEvents\" | \"testID\" | \"nativeID\" | \"collapsable\" | \"needsOffscreenAlphaCompositing\" | ... 49 more ... | \"elevation\">' からの次のプロパティがありません: accessibilityComponentType, accessibilityTraits\n  2 中 2 のオーバーロード, '(props: PropsWithChildren<Pick<Props, \"ref\" | \"style\" | \"removeClippedSubviews\" | \"hitSlop\" | \"onLayout\" | \"pointerEvents\" | \"testID\" | \"nativeID\" | \"collapsable\" | \"needsOffscreenAlphaCompositing\" | ... 49 more ... | \"elevation\"> & { ...; }>, context?: any): ReactElement<...> | ... 1 more ... | null' により、次のエラーが発生しました。\n    型 '{ children: Element; }' には 型 'Pick<Props, \"ref\" | \"style\" | \"removeClippedSubviews\" | \"hitSlop\" | \"onLayout\" | \"pointerEvents\" | \"testID\" | \"nativeID\" | \"collapsable\" | \"needsOffscreenAlphaCompositing\" | ... 49 more ... | \"elevation\">' からの次のプロパティがありません: accessibilityComponentType, accessibilityTraits",
	"source": "ts",
	"startLineNumber": 23,
	"startColumn": 8,
	"endLineNumber": 23,
	"endColumn": 12
}

解決策

https://github.com/callstack/react-native-paper/issues/2442#issuecomment-747366550
同様の問題がissueに上がっていて

yarn add @types/react-native@0.63.40 --dev で別のバージョンの型定義ファイルを入れことで解決

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?