Commit Graph
2095 Commits
Author SHA1 Message Date
Wojciech LewickiandGitHub 577efb1278 feat: bump RN to 0.74 in Example (#2263)
# Summary

PR bumping the Example app to newest RN version.
2024-04-23 13:40:20 +02:00
Wojciech LewickiandGitHub 3ea8fc4976 feat: bump RN to 0.74 in FabricExample and remove rea hacks (#2262)
PR bumping RN to 0.74-rc.9 and removing rea hacks that are no longer
needed 🚀
2024-04-22 19:39:04 +02:00
Eric RozellandGitHub 9f6f6fd40c Adds support to compile react-native-svg against WinAppSDK (#2255)
# Summary

Adds namespace redirects required to compile react-native-svg sources
against WinAppSDK for react-native-windows.

## Test Plan

There aren't a lot of examples for building react-native-windows apps in
open source targeting WinAppSDK, but we have some proprietary builds,
and this source code is working there (it is also still compatible with
UWP).
2024-04-12 11:10:19 +02:00
Tomasz ŻelawskiandGitHub 4b51a41a22 Fix CMakeLists for Android (#2249)
Fix CMakeLists for Android typo
2024-03-26 14:54:35 +01:00
Wojciech Lewicki 15f5b11f31 chore: bump package.json to 15.2.0-rc.0 2024-03-05 14:59:24 +01:00
Wojciech LewickiandGitHub 138c23ba10 feat: add needed changes for RN 0.74 (#2231)
PR bringing support for RN 0.74 and bridgeless mode to the library.
2024-03-05 12:52:09 +01:00
Wojciech Lewicki 31772c0c0f Release 15.1.0 2024-03-05 11:38:43 +01:00
Wojciech LewickiandGitHub 50c2289a2c feat: use dynamics instead of strings for props that can be either string or number (#2238)
# Summary

PR bringing proper support for react-native-reanimated in the library by using dynamics instead of strings for props that can be either string or number.
2024-03-05 11:36:17 +01:00
Wojciech Lewicki e332c4ada9 Release 15.0.0 2024-02-26 15:32:58 +01:00
Wojciech LewickiandGitHub 93ca4fe580 feat: bump minimal ios version to 12.4 (#2232)
# Summary

PR updating the minimal required version of `iOS` to `12.4`. Please
notice that it can be considered a ***BREAKING CHANGE***
2024-02-26 11:34:07 +01:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b800050e04 chore(deps): bump ip from 1.1.8 to 1.1.9 in /Example (#2228)
Bumps [ip](https://github.com/indutny/node-ip) from 1.1.8 to 1.1.9.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/indutny/node-ip/commit/1ecbf2fd8c0cc85e44c3b587d2de641f50dc0217"><code>1ecbf2f</code></a>
1.1.9</li>
<li><a
href="https://github.com/indutny/node-ip/commit/6a3ada9b471b09d5f0f5be264911ab564bf67894"><code>6a3ada9</code></a>
lib: fixed CVE-2023-42282 and added unit test</li>
<li>See full diff in <a
href="https://github.com/indutny/node-ip/compare/v1.1.8...v1.1.9">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ip&package-manager=npm_and_yarn&previous-version=1.1.8&new-version=1.1.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/software-mansion/react-native-svg/network/alerts).

</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 09:45:48 +01:00
Mateusz ŁopacińskiandGitHub b7b6a4fc53 fix: Add missing nan value checks for bounds size (#2220)
This PR adds missing checks whether SVG bounds size values are nan. This PR should fix [this](https://github.com/software-mansion/react-native-svg/issues/978) old issue that still happens sometimes.
2024-02-26 09:43:58 +01:00
MinandGitHub e6b2cc6496 fix: typo on require statement (WithLocalSvg) (#2223)
This PR fixes typo on require statement.
It makes WithLocalSvg function as expected without crash.
2024-02-26 09:18:27 +01:00
程序员小墨andGitHub e06f5879a1 fixed @Deprecated warning in React Native 0.73: 'com.facebook.react.common.StandardCharsets' is deprecated and marked for removal (#2208)
fixed warning in React Native 0.73: 'com.facebook.react.common.StandardCharsets' is deprecated and marked for removal
2024-02-26 09:14:30 +01:00
Tomek ZawadzkiandGitHub 871549cca4 fix: visionOS support (#2218)
This PR fixes the following errors when compiling for visionOS:

Unknown type name 'NSColor'
2024-02-05 11:49:17 +01:00
Wojciech LewickiandGitHub 615f0c68d1 Update ios-build-test.yml (#2207)
PR bumping github action for building iOS and macOS
2024-01-15 15:56:50 +01:00
Tai EnricoandGitHub a33cb315f1 fix: Ensure RNSVG.dll is built with proper publisher/versioning information via new resource file. (#2191)
On Windows, RNSVG.dll is getting flagged by AppLocker on many of our user's devices because it is missing proper publisher/versioning information in its metadata. This forces users to manually add this DLL to AppLocker's allow-list during some update/installation scenarios.

The RNSVG.sln file also currently fails to build from Visual Studio directly, because the fmt project is not explicitly included from the react-native-windows Node package.

Test Plan
For testing, I opened RNSVG.sln in Visual Studio on Windows (with Node packages installed and other build prerequisites) and built it for Debug|x64.

Without my change, building the solution fails to build directly from Visual Studio (since it fails to link fmt.lib when building the Microsoft.ReactNative project). Even when building from the terminal using MSBuild, RNSVG.dll properties do not contain proper publisher/versioning details.

With my change, building the solution in Visual Studio succeeds and RNSVG.dll contains the correct publisher/versioning details in its properties. These can be viewed via File Explorer.
2024-01-15 11:35:49 +01:00
QuangandGitHub ff18553b71 fix(SvgCssUri): support rendering fallback instead of crashing the app when loading invalid content from remote svg file (#2196)
This crash issue still happening for SvgCssUri component
#1760

Apply similar fix #2071
specifically for SvgCSSUri component to prevent crashes due to invalid svg content

What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged
-> When loading invalid svg uri with SvgCSSUri, the app crashes crashes. For example the content returning html content instead of valid svg content.

How did you implement the solution?
-> Passing the fallback prop to SvgCss where will be render when error being captured

What areas of the library does it impact?
SvgCss and SvgUriCss
2024-01-03 16:48:28 +01:00
Eric RozellandGitHub 07b9ca53f4 Fix crash when SVG is unloaded by XAML (#2195)
XAML may unload the root SVG panel, which will trigger a recursive unload. For GroupView, this unload will clear the child collection. However, active operations on the SVG from the React Native UIManager may still be in flight, in which case we may attempt to remove a child that has already been cleared by the root unload.
2024-01-03 15:48:22 +01:00
Renaud ChaputandGitHub d1b02154e3 Fix type exports and enable isolatedModules setting to catch it in tsc (#2197)
This is the same issue as the one I fixed last year in #1874

To prevent this from occurring again, I enabled the `isolatedModules`
Typescript option which will warn when you export non-value identifiers
without using `export type`, which will break transpilation processes
what work on a per-file basis. You can find a [more detailed explanation
in Typescript's
doc](https://www.typescriptlang.org/tsconfig#isolatedModules)
2024-01-03 15:46:49 +01:00
Wojciech LewickiandGitHub fd31240af4 chore: bump examples to 0.73.1 (#2201)
PR bumping apps to RN 0.73.1
2024-01-03 15:44:27 +01:00
Frank Oppervoll-LarsenandGitHub 3939e2059e fix: Correct types for transformsArrayToProps (#2193)
# Summary

Type TransformsStyle['transform'] has `string` added as option from
React Native 0.71.9 onward. This breaks the logic of
`transformsArrayToProps`.

This PR fixes this by scoping down the type, and removing a no-op usage
of `transformsArrayToProps`

This has been broken for a while, but not immediately visible to users
compiling using Metro and Babel.
2024-01-03 12:41:03 +01:00
Oskar KwaśniewskiandGitHub 068820b3fa feat: add visionOS support (#2190)
This PR adds support for visionOS. I've migrated the `UIScreen` API to take `displayScale` from `currentTraitCollection` - same as I did in Core (https://github.com/facebook/react-native/pull/41214/files)
2023-12-06 14:37:54 +01:00
Wojciech Lewicki 2806bb2bee Release 14.1.0 2023-12-04 15:18:30 +01:00
Wojciech LewickiandGitHub 03ca039497 feat: add support for RN 73 (#2181)
PR bumping the library code to compile on new arch on RN 0.73.x and restoring the proper configuration of Image component on new arch on Android.

Also bumping the FabricExample to check if the code works correctly.
2023-12-01 11:58:49 +01:00
Eric RozellandGitHub 20de90d272 Minor fix to prevent crash when Loaded fires twice (#2180)
There are many reasons Loaded can fire twice. Usually, it will happen when the native SvgView component is moved, but it can also happen if an ancestor of SvgView is reparented. There is a crash that appears to occur when we attempt to call CreateResources twice. This resolves that crash.
2023-11-28 10:42:20 +01:00
fc1c9a0347 fix SvgCssUri fallback (#2171)
When using the `SvgCssUri` component, specifying `fallback` does not render the fallback component in the case of an error.

I looked through the source code and believe this is because `SvgCssUri` is rendering a `SvgCss`
https://github.com/software-mansion/react-native-svg/blob/22f47333fbe134b0c697b9c0190a09d6927f2cea/src/css.tsx#L712
which renders a `SvgAst`
https://github.com/software-mansion/react-native-svg/blob/22f47333fbe134b0c697b9c0190a09d6927f2cea/src/css.tsx#L696
which does not use the `fallback` prop
https://github.com/software-mansion/react-native-svg/blob/22f47333fbe134b0c697b9c0190a09d6927f2cea/src/xml.tsx#L96

This fix copies over the error handling code from `SvgUri` so `SvgCssUri` can render a fallback on error. I tested the change in my project and this works like it does for `SvgUri`

Co-authored-by: Maxwell You <maxwell.you@mlb.com>
2023-11-15 16:59:40 +01:00
Wojciech LewickiandGitHub ab52bdd118 fix: remove unused header causing problems (#2175)
PR removing the unused header in `Image` component causing problems mentioned in https://github.com/software-mansion/react-native-svg/issues/2082 and https://github.com/software-mansion/react-native-svg/issues/2154.
2023-11-15 15:20:07 +01:00
Wojciech Lewicki 1868f00f20 Release 14.0.0 2023-11-14 12:41:33 +01:00
Wojciech LewickiandGitHub 2b030dda12 feat: move css to different package for size reduction (#2168)
PR based on https://github.com/software-mansion/react-native-svg/pull/1452 extracting `css` related components to different package to reduce the size of the package.

***THIS IS A BREAKING CHANGE***. From now on, you should import 
```
  SvgCss,
  SvgCssUri,
  SvgWithCss,
  SvgWithCssUri,
  inlineStyles,
  LocalSvg,
  WithLocalSvg,
  loadLocalRawResource,
  ```
 from `react-native-svg/css` package instead.
2023-11-14 11:50:03 +01:00
Marlene CotaandGitHub f88532d195 [Windows] Port to Direct2D to remove win2d dependency (#2052)
This change removes the win2d (Direct2D wrapper) dependency by using D2D directly. This removes the manual step of adding the win2d to any new react-native-windows projects that want to use react-native-svg. It is also a stepping stone to an easier Fabric implementation for windows.
2023-11-14 11:33:19 +01:00
Wojciech LewickiandGitHub 22f47333fb chore: bump examples to rn 0.72.6 (#2166)
PR bumping example apps to the newest RN version so its easier to bump to 0.73.x then.
2023-10-26 10:57:03 +02:00
Nick GerlemanandGitHub 27ee46a1ec Build renderer/components/rnsvg with -std=c++20 (#2141) 2023-10-25 16:33:30 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 BaetsandGitHub 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 (https://github.com/facebook/react-native/commit/bbc517c8c827a4b4e9191dc7aff3a33c07ee7104). 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 BaetsandGitHub 5208a2f6a7 perf: avoid unnecessary shared_ptr copies in Fabric components (#2164)
Ports the upstream best-practice around props handling of shared_ptr in https://github.com/facebook/react-native/commit/a855013fc6c963aca2282b6b43aeeb621eeb88d7
2023-10-25 12:23:14 +02:00
pveghandGitHub 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 LewickiandGitHub 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]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 LewickiandGitHub 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 NajmiandGitHub 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 OliveiraandGitHub 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
aleqsioandGitHub 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 LewickiandGitHub 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 LewickiandGitHub 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 LewickiandGitHub 3ee73bd1f5 Update README.md 2023-08-07 18:43:44 +02:00