react: 17.0.2
react-native: 0.65.1
TS2786: 'View' cannot be used as a JSX component.
Its instance type 'View' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'import("/Users/.../node_modules/@types/react-native/node_modules/@types/react/index").
ReactNode' is not assignable to type 'React.ReactNode'.
Type '{}' is not assignable to type 'ReactNode'.
실행하는데는 전혀 문제가 없지만
빨간맛이 신경쓰인다
구글링해보니,
'Drawer.Navigator' cannot be used as a JSX component with TypeScript · Issue #10507 · react-navigation/react-navigation
Current behavior In the code as follows, I encountered a TypeScript Error message saying 'Drawer.Navigator' cannot be used as a JSX component. import { View, Text } from "react-native&...
github.com
@types/react의 다양한 버전이 문제를 발생시킨다고 한다
해결책은
Yarn
Fast, reliable, and secure dependency management.
classic.yarnpkg.com
package.json에
추가를 하고 yarn install을 해보자
npm 사용자는
package.json | npm Docs
Specifics of npm's package.json handling
docs.npmjs.com
여기를 참조하면 되는듯
이제 해당 코드로 가보면
빨간맛이 사라졌을 것이다
끝.
'프로그래밍 > React Native' 카테고리의 다른 글
[React Native] pnpm monorepo 사용 시, metro error (0) | 2023.09.15 |
---|---|
[React Native] Ignoring ffi-1.15.0 because its extensions are not built (0) | 2023.09.07 |
[React Native] Keychain에 android.keystore 암호 저장하기 only for OS (0) | 2022.09.24 |
[React Native] CodePush Test 방법 (0) | 2022.09.24 |
[React Native] CodePush 설정 시, 추가해야 될 부분 정리 (0) | 2022.09.20 |
댓글