Since UIGraphicsBeginImageContextWithOptions will be depracated in iOS 17 (developer.apple.com/documentation/uikit/1623912-uigraphicsbeginimagecontextwitho), I changed the implementation to not use it and use UIGraphicsImageRenderer instead.
Also added Mask examples to be able to test it.
When react-native-svg is used on a web project where typescript has been configured to resolve .web.ts file exentions before .ts, it causes type errors.
This is because the types in ReactNativeSVG.web.ts don't match the types in ReactNativeSVG.ts
This PR adds the correct types for all exported components on the web platform inside ReactNativeSVG.web.ts. Those changes are:
Added missing prop types for all components
Made style, gradientTransform, and patternTransform optional in BaseProps.
Made styleProp argument of resolve() undefined-able, to support style being an optional prop (this also seems to follow the logic in the body of the function, which has a check for a truthy styleProp)
These changes only impact types - no functionality has been changed.
PR adding the proper handling of strokeDasharray prop for when used with Animated and Reanimated. Code based on #1464 by @bardliu, but with the newest state of the repository.
SvgUri component crashes an app when uri with SVG returns html or some other content instead of valid SVG.
This change prevents those crashes and adds fallback property of JSX type which is rendered instead of corrupted SVG.
I implemented this by multiplying the alpha of the currentColor by the opacity when setting a currentColor brush.
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
Setting Object to the props type does not allow passing any object to the method. So in TypeScript when using the method for example with Path, you will get an error when passing the d. Instead ob Object, you should use at least P so it allows the original props of the component you are using.
PR adding better Marker support on Android. Markers were only displayed on Path on Android. I have looked at the code and Markers are based on elements attribute which was only filled via PathParser. I have modified getPath method on other shapes in order to fill elements attribute. For groups I only copied data from children.
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
PR removing methods that seem unnecessary for the accessibility props since they are provided by superclasses. It was necessary to update fabric updateProps method though, since we don't call super there. Also added proper type definitions and removed unnecessary casts.
It seems that the bug comes from the fact that on iOS we are making a Rect from those values, which takes its starting positions and than width and height as argument, whereas on Android the arguments are strictly 4 bounds, therefore we need to add the starting points to the right and bottom argument.
Since `Image` can use all the props provided by `CommonPathProps` type, we extend it with adding image-specific props.
Co-authored-by: Umesh Dangrecha <umeshdangrecha240@gmail.com>
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
Since AGP 8.0 project namespace must be set inside build script.
It is also the recommended way in Android docs.
It is also recommended, that the package name definition is removed from Android manifest file, but I've had some problems in react-native-screens with RN CLI crashing (as it was expecting the package field to exist) & according to this conversation it'll still be legal to leave package name definition in Android manifest file as long as it exactly matches the value in build script.
PR adding accessibility and testId props and virtual nodes to support e2e tests tools and provide general accessibility support.
Co-authored-by: yonatan.altaraz <yonatan.altaraz@khealth.ai>
Co-authored-by: galkahana <gal.kahana@hotmail.com>
We hit issues when building react-native-svg because of inconsistent use of import type. This change adds ESLint result to ensure consistency. I also ran yarn lint --fix to fix up the code.