Skip to content

Commit

Permalink
fix: cannot set property transform of undefined (gStyle) (#2355)
Browse files Browse the repository at this point in the history
# Summary

Fix bug introduced in #2189, 
if `style` is not provided, then `StyleSheet.flatten` returns
`undefined`, and we're trying to access `transform` of it.

## Test Plan

Run `example` app
  • Loading branch information
jakex7 authored Jul 19, 2024
1 parent 26c4c73 commit 657a102
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/elements/Svg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class Svg extends Shape<SvgProps> {
props.onLayout = onLayout;
}

const gStyle = StyleSheet.flatten(style);
const gStyle = Object.assign({}, StyleSheet.flatten(style));
// if transform prop is of RN style's kind, we want `SvgView` to handle it
// since it can be done here. Otherwise, if transform is of `svg` kind, e.g. string,
// we want G element to parse it since `Svg` does not include parsing of those custom transforms.
Expand Down

0 comments on commit 657a102

Please sign in to comment.