From 0596fd9dc56057e5c74fef8865404aad8c26c35f Mon Sep 17 00:00:00 2001 From: Bohdan Artiukhov <69891500+bohdanprog@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:07:18 +0200 Subject: [PATCH] fix: handle onPress prop on web app (#2302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Summary Closes #1483 Closes #1524 We want a handle `onPress` prop on the web version in SVG components. ## Test Plan Check on `react-native` web version if prop onPress works. ## Compatibility | OS | Implemented | | ------- | :---------: | | Web | ✅ | --- src/ReactNativeSVG.web.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ReactNativeSVG.web.ts b/src/ReactNativeSVG.web.ts index ba940a595..a87789bc9 100644 --- a/src/ReactNativeSVG.web.ts +++ b/src/ReactNativeSVG.web.ts @@ -195,6 +195,7 @@ const prepare = ( onResponderRelease?: (e: GestureResponderEvent) => void; onResponderTerminate?: (e: GestureResponderEvent) => void; onResponderTerminationRequest?: (e: GestureResponderEvent) => boolean; + onClick?: (e: GestureResponderEvent) => void; transform?: string; gradientTransform?: string; patternTransform?: string; @@ -266,7 +267,9 @@ const prepare = ( styles.fontStyle = fontStyle; } clean.style = resolve(style, styles); - + if (props.onPress != null) { + clean.onClick = props.onPress; + } return clean; };