From af68c93d040b4a4877c7c9830c6f97e9ff397e7e Mon Sep 17 00:00:00 2001 From: Wojciech Lewicki Date: Tue, 26 Jul 2022 16:03:38 +0200 Subject: [PATCH] add missing onLayout prop typings (#1815) onLayout prop typings are missing. This PR simply adds missing onLayout prop to svg nodes. Co-authored-by: Sergey Tshovrebov --- src/elements/Image.tsx | 4 +++- src/index.js.flow | 7 ++++++- src/lib/extract/types.ts | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/elements/Image.tsx b/src/elements/Image.tsx index 6dc9692a..72806dc2 100644 --- a/src/elements/Image.tsx +++ b/src/elements/Image.tsx @@ -5,6 +5,7 @@ import { withoutXY } from '../lib/extract/extractProps'; import { ClipProps, CommonMaskProps, + NativeProps, NumberProp, ResponderProps, TouchableProps, @@ -18,7 +19,8 @@ export interface ImageProps extends ResponderProps, CommonMaskProps, ClipProps, - TouchableProps { + TouchableProps, + NativeProps { x?: NumberProp; y?: NumberProp; width?: NumberProp; diff --git a/src/index.js.flow b/src/index.js.flow index 9e82f6e8..f57710ea 100644 --- a/src/index.js.flow +++ b/src/index.js.flow @@ -9,6 +9,7 @@ import * as ReactNative from "react-native"; import { ColorValue, GestureResponderEvent, + LayoutChangeEvent, TransformsStyle, } from "react-native"; export type NumberProp = string | number; @@ -191,6 +192,9 @@ export interface CommonMarkerProps { markerMid?: string; markerEnd?: string; } +export interface NativeProps { + onLayout?: (event: LayoutChangeEvent) => void; +} export type CommonPathProps = { ... } & FillProps & StrokeProps & ClipProps & @@ -200,7 +204,8 @@ export type CommonPathProps = { ... } & FillProps & TouchableProps & DefinitionProps & CommonMarkerProps & - CommonMaskProps; + CommonMaskProps & + NativeProps; export type CircleProps = { cx?: NumberProp, cy?: NumberProp, diff --git a/src/lib/extract/types.ts b/src/lib/extract/types.ts index eb1bac8c..4e242eff 100644 --- a/src/lib/extract/types.ts +++ b/src/lib/extract/types.ts @@ -232,6 +232,10 @@ export interface CommonMarkerProps { markerEnd?: string; } +export interface NativeProps { + onLayout?: (event: LayoutChangeEvent) => void; +} + export interface CommonPathProps extends FillProps, StrokeProps, @@ -242,7 +246,8 @@ export interface CommonPathProps TouchableProps, DefinitionProps, CommonMarkerProps, - CommonMaskProps {} + CommonMaskProps, + NativeProps {} export type ResponderInstanceProps = { touchableHandleResponderMove?: (e: GestureResponderEvent) => void;