Skip to content

Commit

Permalink
fix: handle onPress prop on web app (#2302)
Browse files Browse the repository at this point in the history
# 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     |    ✅     |
  • Loading branch information
bohdanprog authored Jun 17, 2024
1 parent 785a2bc commit 0596fd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ReactNativeSVG.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ const prepare = <T extends BaseProps>(
onResponderRelease?: (e: GestureResponderEvent) => void;
onResponderTerminate?: (e: GestureResponderEvent) => void;
onResponderTerminationRequest?: (e: GestureResponderEvent) => boolean;
onClick?: (e: GestureResponderEvent) => void;
transform?: string;
gradientTransform?: string;
patternTransform?: string;
Expand Down Expand Up @@ -266,7 +267,9 @@ const prepare = <T extends BaseProps>(
styles.fontStyle = fontStyle;
}
clean.style = resolve(style, styles);

if (props.onPress != null) {
clean.onClick = props.onPress;
}
return clean;
};

Expand Down

0 comments on commit 0596fd9

Please sign in to comment.