2163 Commits

Author SHA1 Message Date
Nick Gerleman
27ee46a1ec Build renderer/components/rnsvg with -std=c++20 (#2141) 2023-10-25 16:33:30 +02:00
dependabot[bot]
c514e5a247 chore(deps): bump @babel/traverse from 7.22.8 to 7.23.2 in /Example (#2158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-25 15:08:31 +02:00
Pieter De Baets
694572aa85 fix: props are no longer unnecesarily copied in new architecture (#2163)
React Native no longer allows implicit copying of Props, since they're large data-structures and copies are often accidental (bbc517c8c8). This updates react-native-svg to be compatible with this change, and will provide a small perf win.
2023-10-25 12:23:44 +02:00
Pieter De Baets
5208a2f6a7 perf: avoid unnecessary shared_ptr copies in Fabric components (#2164)
Ports the upstream best-practice around props handling of shared_ptr in a855013fc6
2023-10-25 12:23:14 +02:00
pvegh
a5dae2f54d enable buildConfig generation to better support AGP8 (#2143)
Since AGP8 this flag is disabled by default. Consumer projects have to enable this flag in them globally if the library doesn't do this correctly itself, but uses custom buildConfig fields.

- What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged
Solves Build Errors with default setup using AGP8+
- What is the feature? (if applicable)
No errors and better build performance than the workaround in consuming projects would be.
2023-10-25 11:44:50 +02:00
Wojciech Lewicki
f9c7d8a807 Release 13.14.0 2023-09-20 17:29:47 +02:00
Wojciech Lewicki
7c2c179654 fix: web not working with reanimated in example (#2140)
PR fixing web example when using reanimated since __DEV__ is not defined there.
2023-09-20 16:27:25 +02:00
dependabot[bot]
c88ae5889b chore(deps): bump activesupport from 6.1.7.4 to 7.0.7.2 in /TestsExample (#2122)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-20 16:24:24 +02:00
Wojciech Lewicki
5f3bd0dd48 fix: error for transform on web (#2139)
Setting transform prop of svg component as undefined in web causes the error, so we set it only if the parsed value is not undefined.
2023-09-20 16:14:35 +02:00
Saad Najmi
23d65b9835 [macOS][Xcode 15] Avoid using dirtyRect in drawRect: (#2136)
Apple made a breaking change in Xcode 15 / macOS Sonoma which breaks usages of drawRect:. You can no longer trust that the OS will provide you a dirtyRect will be within the bounds of your view. Specifically (from the appkit release notes):

Filling the dirty rect of a view inside of -drawRect. A fairly common pattern is to simply rect fill the dirty rect passed into an override of NSView.draw(). The dirty rect can now extend outside of your view’s bounds. This pattern can be adjusted by filling the bounds instead of the dirty rect, or by setting clipsToBounds = true.

This led to an unfortunate bug where any SVG drawn took up the full width/height of your window. Let's follow Apple's advice and draw using [self bounds] instead of dirtyRect.
2023-09-20 15:22:24 +02:00
Gabriel dos Santos Oliveira
234f7b7302 docs: Update deprecated expo install instructions to `npx expo install´ (#2128)
Changed expo install react-native-svg to npx expo install react-native-svg, because global expo-cli is deprecated [docs-expo-cli](https://docs.expo.dev/archive/expo-cli/)
2023-09-20 15:09:36 +02:00
aleqsio
30ba9feae2 Create FUNDING.yml (#2133) 2023-09-13 17:15:15 +02:00
Wojciech Lewicki
849513946e Release 13.13.0 2023-08-24 15:34:12 +02:00
Wojciech Lewicki
7e514d7232 feat: add macos back to Example app (#2119)
PR restoring macos CI job and restoring usage of UIGraphicsBeginImageContextWithOptions on macos since there is no implementation for UIGraphicsImageRendererFormat there yet.
2023-08-24 12:07:27 +02:00
Wojciech Lewicki
fb28d7809c Release 13.12.0 2023-08-21 16:00:42 +02:00
Wojciech Lewicki
f5503e2c9b feat: remove UIGraphicsBeginImageContextWithOptions from repo (#2117)
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.
2023-08-21 11:35:50 +02:00
Wojciech Lewicki
9176c4c95a Release 13.11.0 2023-08-07 18:49:17 +02:00
Wojciech Lewicki
3ee73bd1f5 Update README.md 2023-08-07 18:43:44 +02:00
Wojciech Lewicki
416ccc8a86 fix: bump packages, eslint, tsconfig, prettier and resolve all conflicts (#2114)
PR bumping packages, eslint, tsconfig, prettier and resolving all conflicts connected to it.
2023-08-07 17:44:58 +02:00
M.H.Pousti
3599c57e31 docs: update README.md (#2110)
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
2023-08-02 15:20:34 +02:00
Letty
9cd828067f docs: update usage.md for react-native 0.72 (#2104)
metro.config.js snippet in USAGE.md was outdated, therefore i updated this according the config from react-native-svg-transformer.
2023-08-01 17:59:44 +02:00
_nderscore
34243a53af fix: make web platform types compatible with native types (#2091)
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.
2023-07-22 16:53:39 +02:00
Wojciech Lewicki
0e931577ac Release 13.10.0 2023-07-07 12:53:47 +02:00
Wojciech Lewicki
78aaffad10 feat: strokeDasharray with Animated (#2089)
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.
2023-07-07 11:21:04 +02:00
Wojciech Lewicki
24dba65b7a chore: bump TestsExample to 0.72 (#2088) 2023-07-06 20:39:19 +02:00
Wojciech Lewicki
54bec6d10c chore: run prettier and lint (#2087) 2023-07-06 14:41:36 +02:00
PiotrWszolek
e04a159b46 Prevents SvgUri crashes when uri is invalid and adds fallback prop (#2071)
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.
2023-07-06 14:21:20 +02:00
Christoph Pader
7983ad2ca6 Add web support for toDataURL() on svg tags (#2072)
Implement web support for Svg.toDataURL()

Continuing the work of @wood1986 from #1361

Co-authored-by: wood1986 <5212215+wood1986@users.noreply.github.com>
2023-07-06 00:19:18 +02:00
dependabot[bot]
f6570d31de chore(deps): bump fast-xml-parser from 4.2.4 to 4.2.5 in /TestsExample (#2085)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 23:40:27 +02:00
dependabot[bot]
4061203f23 chore(deps): bump vm2 from 3.9.14 to 3.9.19 (#2056)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 23:39:31 +02:00
dependabot[bot]
e6724d6b57 chore(deps): bump fast-xml-parser from 4.1.3 to 4.2.4 in /TestsExample (#2063)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 23:39:18 +02:00
Wojciech Lewicki
91f6bd1fa9 chore: bump Examples to 0.72 (#2084)
Bump Example and FabricExample to RN 0.72
2023-07-05 22:46:42 +02:00
Ibiyemi Abiodun
7c1d537c2f Fix #1345: opacity does not work with currentColor on Android (#2080)
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>
2023-07-05 18:06:23 +02:00
Hampus Sjöberg
50b555cde4 Fix syntax error in RNSVGImageShadowNode::initialStateData (#2079)
Fix syntax error in RNSVGImageShadowNode::initialStateData
2023-07-05 17:42:13 +02:00
sgabriel
a1090f25a1 fix: Updating iOS version #2038 (#2041)
Updated iOS version to 12.4 to be able to build on Xcode 14.3
2023-05-24 13:13:32 +02:00
Jan
98fdeaa516 fix: remove deprecated import from react-native-web (#2027)
fix: remove deprecated import from react-native-web
2023-05-24 13:03:34 +02:00
fauri13
98836149db Fix setNativeProps type (#2058)
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.
2023-05-23 12:28:08 +02:00
Christoph Purrer
dfec171068 Fix compilation errors on Windows (#2045)
Fix compilation errors on Windows
2023-05-23 09:50:23 +02:00
Wojciech Lewicki
d31ffdb762 Release 13.9.0 2023-03-30 17:35:20 +02:00
Ganapathy S
11edfc4a71 fix: read svg file on android (#2016)
PR fixing the behavior for fetching local files in `SvgUri` on `Android`.

Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
2023-03-30 17:00:53 +02:00
Wojciech Lewicki
29382d927a fix: scale path markers so they match ios (#2018)
PR adding scaling of markers of path in order to make them behave the same as on iOS. Also bumped the versions of agp and spotless.
2023-03-30 14:27:30 +02:00
Mickael Lecoq
a7af70c43d fix #1592 : add marker support on Rect, Line, Ellipse, Circle and Group (#1594)
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>
2023-03-29 15:25:36 +02:00
dependabot[bot]
911151ac3b chore(deps): bump @xmldom/xmldom from 0.7.6 to 0.7.9 (#2004)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 11:00:50 +02:00
dependabot[bot]
f3d8c9d7bc chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#1982)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 11:00:21 +02:00
Wojciech Lewicki
a917baf2ec fix: remove unnecessary methods provided by superclasses for accessibility (#2013)
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.
2023-03-27 15:18:59 +02:00
Alex Afanasenko
ccda91c8df fix: mask render on android (#1981)
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.
2023-03-24 14:25:24 +01:00
Umesh Patidar
baf011fbf1 fix: make image props extend CommonPathProps (#2007)
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>
2023-03-24 12:23:16 +01:00
Kacper Kafara
998c3e310e chore: set library namespace in build script (#2005)
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.
2023-03-23 20:39:41 +01:00
Michal
63bf27006b Fix SVG parsing when the closing tags include whitespace (#2012)
Allows whitespace to be used in the closing tag.
2023-03-23 19:59:07 +01:00
Hampus Sjöberg
5cfa4dfc6a Don't set self.opaque = false on macOS (#2008)
Don't set `self.opaque = false` on macOS
2023-03-23 17:18:55 +01:00