Commit Graph

14 Commits

Author SHA1 Message Date
Andrew Coates
d02c997352 fix: react-native-windows implementation for new architecture (#2527)
# Summary
There are two main things going on with the PR. Both involve a reworking
of the new arch implementation of rn-svg for windows.
The current implementation attempts to implement a svg renderer from
scratch. There are numerous edge cases that it wasn't handling
correctly, and the performance had some serious issues. This
implementation switches to use the svg rendering path built into
Direct2D. This brings significant performance improvements.

The 2nd issue is there have been various breaking changes in
react-native-windows for how new arch native components are implemented.
This brings the rn-svg implementation in line with those latest changes.

## Test Plan

Primary testing right now is loading up the example app in the repo.
New arch on react-native-windows is still in somewhat early days - so
there are not really current users of this code. I am integrating this
code into Microsoft Office, where I have tested some scenarios. But we
will get expanded testing as we roll out the new arch. I expect there to
be some follow-ups as we expand our usage. The version of rn-svg before
this PR doesn't build with the latest new arch react-native-windows
versions. - So its hard to get worse than that.

### What's required for testing (prerequisites)?

### What are the steps to reproduce (after prerequisites)?

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    N/A  |
| MacOS   |    N/A      |
| Android |    N/A      |
| Web     |          |

## Checklist

- [x] I have tested this on a device and a simulator
- [ ] I added documentation in `README.md`
- [ ] I updated the typed files (typescript)
- [ ] I added a test for the API in the `__tests__` folder
2024-11-15 12:17:12 +01:00
Marlene Cota
b80f102b09 feat(windows): add fabric support (#2321)
# Summary
This PR adds Fabric support and a FabricExample app for Windows.

Windows support for Fabric is experimental and as such APIs are subject
to change/break.

## Test Plan


https://github.com/software-mansion/react-native-svg/assets/1422161/2a7db119-44a8-4ee1-a837-41ca8320d8fa

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |         |
| Android |         |
| Windows |         |

## Checklist
- [x] I have tested this on a device and a simulator
- [ ] I added documentation in `README.md`
- [ ] I updated the typed files (typescript)
- [ ] I added a test for the API in the `__tests__` folder
2024-08-19 08:18:45 +02:00
Marlene Cota
2514ac4fdf feat(windows): add support for 74 and bump Example (#2315)
Added support for RNW 74.
Bumped windows Example to 74.
Updated README.md to remove instructions on how to import Win2D since we no longer use it.
2024-07-02 09:34:04 +02:00
Arthurmtro
680806e5fe Add dxguid.lib to release action (#2243)
On Windows, it's no longer possible to build the release because some lib are missing
2024-05-06 09:16:47 +02:00
Eric Rozell
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
Tai Enrico
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
Eric Rozell
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
Eric Rozell
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
Marlene Cota
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
Christoph Purrer
dfec171068 Fix compilation errors on Windows (#2045)
Fix compilation errors on Windows
2023-05-23 09:50:23 +02:00
Marlene Cota
38da5fb67c feat(windows): add clipPath and touch events (#1933)
Adding support for clipPath and touch events.
2023-01-04 15:51:08 +01:00
Marlene Cota
fc2e0e091a fix: fill/stroke setters and implement currentColor on Windows (#1928)
Starting in v13, the switch to Fabric changed the color prop values sent to the native side, so all colors on Windows were defaulting to black. Updated the property setters to handle that change and also added support for the SVG color prop / "currentColor".
2022-12-05 15:22:39 +01:00
Marlene Cota
1ef46af726 Fix windows build issues (#1923)
Addresses build issues seen in #1803, #1809, and #1863 by making updating RNSVG.vcxproj and making it more resilient to template/version changes in react-native-windows.
2022-11-30 14:50:32 +01:00
Marlene Cota
28d51bdf06 Add Windows support (#1632)
Adds Windows support.

Co-authored-by: Adam Gleitman <adam.gleitman@gmail.com>
Co-authored-by: REDMOND\agnel <agnel@microsoft.com>
2022-07-15 11:50:58 +02:00