Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

SafeAreaView ref generates a Typescript error

$
0
0

I'm getting a stragne error in TypeScript SafeAreaView component. I crated other refs for WebView and it doesn't fail, only seems to fail when assigned to the SafeAreaView component.

import { useRef, MutableRefObject } from 'react';import { SafeAreaView } from 'react-native-safe-area-context';......const topSafeAreaViewRef = useRef(null);......<SafeAreaView ref={topSafeAreaViewRef} style={styles.container} edges={['top', 'right', 'left']} >

TS2322: Type '{ children: Element; ref: MutableRefObject; style:{ flex: number; backgroundColor: any; }; edges: ("top" | "right" |"left")[]; }' is not assignable to type 'IntrinsicAttributes &ViewProps & { children?: ReactNode; mode?: "padding" | "margin" |undefined; edges?: readonly Edge[] | undefined; }'.   Property 'ref'does not exist on type 'IntrinsicAttributes & ViewProps & { children?:ReactNode; mode?: "padding" | "margin" | undefined; edges?: readonlyEdge[] | undefined; }'.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>