fix: cannot set property transform of undefined (gStyle) (#2355)

# 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
This commit is contained in:
Jakub Grzywacz
2024-07-19 11:52:22 +02:00
committed by GitHub
parent 26c4c73400
commit 657a102b5f

View File

@@ -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.