diff --git a/src/SafeArea.types.ts b/src/SafeArea.types.ts index d3d23b62..20cdee6b 100644 --- a/src/SafeArea.types.ts +++ b/src/SafeArea.types.ts @@ -1,6 +1,6 @@ import type * as React from 'react'; +import type { Component } from 'react'; import type { NativeSyntheticEvent, ViewProps } from 'react-native'; -import NativeSafeAreaView from './specs/NativeSafeAreaView'; export type Edge = 'top' | 'right' | 'bottom' | 'left'; export type EdgeMode = 'off' | 'additive' | 'maximum'; @@ -42,6 +42,4 @@ export interface NativeSafeAreaViewProps extends ViewProps { edges?: Edges; } -export type NativeSafeAreaViewInstance = InstanceType< - typeof NativeSafeAreaView ->; +export type NativeSafeAreaViewInstance = Component diff --git a/src/SafeAreaContext.tsx b/src/SafeAreaContext.tsx index ed192d76..caed333c 100644 --- a/src/SafeAreaContext.tsx +++ b/src/SafeAreaContext.tsx @@ -119,7 +119,7 @@ export function SafeAreaListener({ { + onInsetsChange={(e: InsetChangedEvent) => { onChange({ insets: e.nativeEvent.insets, frame: e.nativeEvent.frame, diff --git a/src/specs/NativeSafeAreaContext.ts b/src/specs/NativeSafeAreaContext.ts index b384b65b..4f4aef3b 100644 --- a/src/specs/NativeSafeAreaContext.ts +++ b/src/specs/NativeSafeAreaContext.ts @@ -1,20 +1,20 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { Double } from 'react-native/Libraries/Types/CodegenTypes'; +import type { CodegenTypes } from 'react-native'; export interface Spec extends TurboModule { getConstants: () => { initialWindowMetrics?: { insets: { - top: Double; - right: Double; - bottom: Double; - left: Double; + top: CodegenTypes.Double; + right: CodegenTypes.Double; + bottom: CodegenTypes.Double; + left: CodegenTypes.Double; }; frame: { - x: Double; - y: Double; - width: Double; - height: Double; + x: CodegenTypes.Double; + y: CodegenTypes.Double; + width: CodegenTypes.Double; + height: CodegenTypes.Double; }; }; }; diff --git a/src/specs/NativeSafeAreaProvider.ts b/src/specs/NativeSafeAreaProvider.ts index 5e6974ee..45ff4d58 100644 --- a/src/specs/NativeSafeAreaProvider.ts +++ b/src/specs/NativeSafeAreaProvider.ts @@ -1,27 +1,23 @@ -import type { - DirectEventHandler, - Double, -} from 'react-native/Libraries/Types/CodegenTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type { ViewProps, HostComponent } from 'react-native'; +import type { CodegenTypes, ViewProps, HostComponent } from 'react-native'; +import { codegenNativeComponent } from 'react-native'; export type Event = Readonly<{ insets: Readonly<{ - top: Double; - right: Double; - bottom: Double; - left: Double; + top: CodegenTypes.Double; + right: CodegenTypes.Double; + bottom: CodegenTypes.Double; + left: CodegenTypes.Double; }>; frame: Readonly<{ - x: Double; - y: Double; - width: Double; - height: Double; + x: CodegenTypes.Double; + y: CodegenTypes.Double; + width: CodegenTypes.Double; + height: CodegenTypes.Double; }>; }>; export interface NativeProps extends ViewProps { - onInsetsChange?: DirectEventHandler; + onInsetsChange?: CodegenTypes.DirectEventHandler; } export default codegenNativeComponent( diff --git a/src/specs/NativeSafeAreaView.ts b/src/specs/NativeSafeAreaView.ts index 0ab6adf8..2c68c889 100644 --- a/src/specs/NativeSafeAreaView.ts +++ b/src/specs/NativeSafeAreaView.ts @@ -1,9 +1,8 @@ -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type { WithDefault } from 'react-native/Libraries/Types/CodegenTypes'; import type { ViewProps, HostComponent } from 'react-native'; +import { codegenNativeComponent } from 'react-native'; export interface NativeProps extends ViewProps { - mode?: WithDefault<'padding' | 'margin', 'padding'>; + mode?: 'padding' | 'margin'; edges?: Readonly<{ top: string; right: string;