53 Commits

Author SHA1 Message Date
Jakub Grzywacz
81eb2fb357 fix: ios build CI (#2605)
# Summary

Apparently there are some issues with newer xcode versions on GitHub CI

Similar changes have been made in Gesture Handler
https://github.com/software-mansion/react-native-gesture-handler/pull/3319/
and Screens
https://github.com/software-mansion/react-native-screens/pull/2620
2025-01-17 10:23:19 +01:00
Jakub Grzywacz
a9e702c462 test: fix e2e tests (#2578)
# Summary

Fix broken E2E iOS tests

## Test Plan

CI should be green
2024-12-16 13:14:31 +01:00
Jakub Grzywacz
8be900eee3 fix: iOS E2E action (#2510)
# Summary

`run-ios` script has been removed from `react-native@latest` so we
shouldn't use that (and probably should migrate to
@react-native-community/cli in the future)
2024-10-25 17:25:59 +02:00
Jakub Grzywacz
0c4f58d9f5 refactor: rename example to paper-example (#2509)
# Summary

Rename example app to match the pattern.
2024-10-25 17:15:00 +02:00
Jakub Grzywacz
b3b175a7fb feat: move examples to ./apps (#2507)
# Summary

Due to the large number of example apps in the repository, I decided to
change the structure and move all applications into an "apps" folder to
maintain a clear structure.
2024-10-25 16:12:23 +02:00
Jakub Grzywacz
1daacdf474 chore: extract Windows example (#2505)
# Summary

While upgrading `./example` app to `react-native@0.76.0` I've
encountered conflicts on `@react-native/gradle-plugin` caused by
`react-native-windows@0.74.9` depending on
`@react-native/gradle-plugin@0.74.83`
This PR extracts Windows example to separate `./paper-windows-example`
so it won't conflict with RN updates in the future
2024-10-25 13:29:19 +02:00
Jakub Grzywacz
7d083b4ef4 chore: fix macos ci (#2501)
# Summary

Merge `macos-build-test-paper.yml` and `macos-build-test-fabric.yml`
into one `macos-build-test.yml`
2024-10-23 12:40:10 +02:00
Jakub Grzywacz
3aebbb22fd chore: improve ci workflow (#2499)
# Summary
2024-10-23 10:02:46 +02:00
Bohdan Artiukhov
2b56bb4d03 chore: update iOS workflows (#2467)
# Summary

Update iOS workflows.
2024-10-03 08:30:17 +02:00
Bartosz Stefańczyk
a089cc2efc feat: e2e snapshot tests (#2338)
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect -->

# Summary

This PR adds E2E tests based on view screenshots done via
`react-native-view-shot`. It only works with devices that have their
[pixel ratio](https://reactnative.dev/docs/pixelratio) equal `3`. If you
want to use device with different pixel ratio, you need to adjust it in
`e2e/generateReferences.ts` viewport and regenerate reference images
(see below).

Steps to run tests:
- Run Metro server for example app via `yarn start` in example app's
directory
- Run `example` app on platform of your choice (currently only Android &
iOS are supported) via `yarn android` or `yarn ios` in example app's
directory
- Run `yarn e2e` in project's root directory to start Jest server
- Select `E2E` tab in example app
- Wait for tests to finish
- You can see test results, as well as diffs (actual rendered svg vs
reference image) in `e2e/diffs` directory

Steps to add new test cases:
- Put SVG of your choice to `e2e/cases` directory
- Run `yarn generateE2eRefrences`, this will open headless chrome
browser via `puppeteer` and snapshot all rendered SVGs to .png files and
later use them as reference in tests
- You should see new .png files in `e2e/references`
- When you run E2E tests again, it will use new test case(s) you've
added

## Test Plan


https://github.com/software-mansion/react-native-svg/assets/41289688/24ee5447-ce9a-43b6-9dde-76229d25a30a


https://github.com/software-mansion/react-native-svg/assets/41289688/71d1873f-8155-4494-80bd-e4c1fa72a065


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

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

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    	     |
| Android |         |
| Web | 			 |
## Checklist



<!-- Check completed item, when applicable, via: [X] -->

- [X] I have tested this on a device and a simulator
- [x] I added documentation in `README.md`
- [X] I updated the typed files (typescript)
- [X] I added a test for the API in the `__tests__` folder

---------

Co-authored-by: bohdanprog <bohdan.artiukhov@swmansion.com>
Co-authored-by: Jakub Grzywacz <jakub.grzywacz@swmansion.com>
2024-08-23 13:29:38 +02: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
Bohdan Artiukhov
ae6c492458 feat: clean GitHub workflows (#2391)
# Summary
Clean the `.github` folder, and update the pull request template
2024-08-05 14:18:06 +02:00
Bohdan Artiukhov
4fd2ccdb94 fix: add new macos examples (#2372)
# Summary
We want to avoid problems with GitHub workflows.
Create a new Macos example for new and old architecture.

## Test Plan

Run GitHub workflows

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| macOS     |         |

---------

Co-authored-by: Jakub Grzywacz <jakub.grzywacz@swmansion.com>
2024-07-29 14:46:00 +02:00
Bohdan Artiukhov
c5e601a98f feat: Add link to QA section and feature requests (#2373)
# Summary
Add a link to the QA section and feature requests
2024-07-29 09:43:59 +02:00
bohdanprog
45d6484c6a feat: check build only old arch 2024-07-26 11:09:40 +02:00
Bohdan Artiukhov
67620f5b6a fix: macOS new architecture build (#2341)
# Summary
Based on recommendations from this
[proposition](https://github.com/software-mansion/react-native-svg/issues/2192#issuecomment-2177330499)
and added some changes now we can build macOS using the new
architecture.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| macOS     |         |

---------

Co-authored-by: Maciej Stosio <maciekstosio@users.noreply.github.com>
2024-07-23 15:34:32 +02:00
Maciej Stosio
567e90521a Feat: add scripts to sync archs (#2357)
Changes moved from:
https://github.com/software-mansion/react-native-screens/pull/2224

## Description

When changing native props on Fabric, codegen generates corresponding
interfaces and delegates. To make sure both implementations are
consistent, we implement those interfaces on Paper too. Currently, after
generating interfaces using codegen, developer needs to copy
corresponding files for paper manually. This task adds Gradle task, that
automates this.

## Changes
Current assumption: 
Two scripts: `check-archs-consistency` and `sync-archs`. The first one
generates codegen interfaces and compares them with what we have for
paper, the second generates and copies for paper to sync the archs.
- sync is run when staged on changes to `src/paper`
- check is run on CI when `src/paper` or
`android/src/paper/java/com/facebook/react/viewmanagers` changes

## Test code and steps to reproduce

Open `src/fabric/LineNativeComponent.ts` or/and
`src/fabric/NativeSvgRenderableModule.ts` and remove any proper form
interface. Now:
- when building paper, interface should be updated
- when committing, interface should be updated
- if committed and pushed, Test consistency between Paper & Fabric
should fail :)
Brining back the prop and repeating up should cause the interface back
and CI green.
Posting changes in other places should cause CI task to run. 

You can also run those commands yourself using `yarn
check-archs-consistency` and `yarn sync-archs`
2024-07-22 14:58:37 +02:00
Marlene Cota
3b360a2b58 feat: improve windows ci job (#2329)
Improves the windows build time.
2024-07-12 09:51:43 +02:00
Bohdan Artiukhov
7c1602e291 feat: change folders structure (#2319)
# Summary
extract the shared example and use it in example and fabric-example, macos-example

## Test Plan

Run those apps manually.
2024-07-05 13:00:13 +02:00
Marlene Cota
1ad180cba0 feat: add Example Windows build workflow (#2322)
PR adding build workflow for windows.
2024-07-03 10:02:59 +02:00
Bohdan Artiukhov
fe48dfb238 feat: update needs-more-info git workflow (#2314)
# Summary
update check of react-native-svg version in GitHub workflow.
2024-06-28 09:04:45 +02:00
Bohdan Artiukhov
47d9c27997 fix: issue template (#2301)
# Summary
Fix issue template
2024-06-13 17:11:14 +02:00
Bohdan Artiukhov
9d3c781b2e feat: add new bug issue template, and github actions (#2300)
# Summary

We want to add a new bug issue template, and new GitHub actions to check
if all information exists in issues.
2024-06-13 17:03:54 +02:00
Bohdan Artiukhov
556f1e3ec0 feat: github action close-when-stale (#2296)
# Summary
Add GH action to close issues that were without response to the
question.

## Test Plan

Check if that GH action closes the issue if no one response to the
question.
2024-06-12 15:33:29 +02:00
Bohdan Artiukhov
558a59609a chore: remove macos-build-test.yml (#2292)
# Summary

- remove `macos-build-test.yml`

## Test Plan

merge that PR to the main, and check if `macos-build` action will be run
2024-06-07 21:59:32 +02:00
Wojciech Lewicki
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
615f0c68d1 Update ios-build-test.yml (#2207)
PR bumping github action for building iOS and macOS
2024-01-15 15:56:50 +01:00
Wojciech Lewicki
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
aleqsio
30ba9feae2 Create FUNDING.yml (#2133) 2023-09-13 17:15:15 +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
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
Risto Keravuori
eaf79ea3ee Upgrade rn-builder-bob to enable tree-shaking in rn-web (#1993)
Upgrade rn-builder-bob to enable tree-shaking in rn-web
2023-03-21 14:49:28 +01:00
Wojciech Lewicki
1a2e8c74ed chore: update RN versions to 0.70.5 (#1910)
PR bumping example apps to RN 0.70.5 since previous version will cause CI to fail due to bug in RN.
2022-11-07 16:58:25 +01:00
Wojciech Lewicki
1beacf1be2 feat: make pointer events work on both platforms (#1879)
PR adding proper handling of pointerEvents in the library. Based on the comment by @RSNara :

> For all Android components, static ViewConfigs are generated from the components types + BaseVIewConfig.android.js. The BaseViewConfig for all android components is facebook/react-native@c5217f1/Libraries/NativeComponent/BaseViewConfig.android.js#L288-L297, which doesn't contain the pointerEvents validAttribute. So, React Native SVG components must re-declare the pointerEvents validAttribute. Otherwise, the pointerEvents validAttribute won't be in the static ViewConfig, which means React won't pass that prop to native with Static ViewConfigs.

We needed a way to trick codegen since we added our own pointerEvents with string type, and such prop is already present in ViewProps from react-native, but as a union of strings, so their types did not match. As codegen parses string literals, we include changed ViewProps type, without pointerEvents prop, so we satisfy both codegen and TS.

As for how pointerEvents are handled now:

iOS:
Paper: prop is passed in RCTViewManager but it looks like it does not matter what you pass there, since even if you set none, resulting in view.userInteractionEnabled = NO; (facebook/react-native@065db68/React/Views/RCTViewManager.m#L256), custom implementation of hitTest will not take it into account anyhow.

Fabric: we don’t use pointerEvents prop but it is not a problem since it is not used in the implementation of neither SvgView and RCTViewComponentView (it is used in hitTest method there, but we override it)

Android:
Paper: the prop was passed through ReactViewManager and was set on the view directly. But the setter for pointerEvents is not visible outside of ReactViewGroup . After adding Fabric integration for both platforms: BaseViewManager does not implement setter for pointerEvents so we have to add the prop by ourselves. Still, we cannot call the setter from ReactViewGroup since it is not visible, so all the logic for pointerEvents should be migrated to SvgView unfortunately or we should use reflection to get that method.

Despite that, it seems that behavior differs on Android and iOS since setting pointerEvents to none on Android makes the view not clickable, whereas on iOS it does not change anything.
2022-09-30 14:24:34 +02:00
Wojciech Lewicki
e7395b41c0 feat: improve ios ci job (#1878)
PR based on software-mansion/react-native-reanimated#3448 which should improve the caches of iOS CI jobs resulting in smaller build time.

Co-authored-by: Tomek Zawadzki <tomekzawadzki98@gmail.com>
2022-09-22 12:51:09 +02:00
Tomek Zawadzki
2ff92267ed Fix concurrent CI (#1853)
This PR should hopefully fix CI jobs for Example and FabricExample apps being cancelled by using matrix.working_directory variable in concurrency.group identifier.
2022-09-02 16:49:01 +02:00
Wojciech Lewicki
778703d8a3 feat: remove unused common folder (#1838)
PR removing common directory from library since it is not used currently due to no custom shadow nodes etc. in Fabric implementation.
2022-08-17 15:50:01 +02:00
Wojciech Lewicki
0a26639532 chore: bump library and examples to rn 0.70-rc3 (#1837)
PR bumping library to RN 0.70-rc3, which might make it not compatible with earlier versions of RN on Fabric. It should come with the same change in other libraries.

In this PR, I had to remove macos code from Example since it breaks @react-native-community/cli resolution. Hopefully we can bring it back soon.
2022-08-17 14:24:50 +02:00
Wojciech Lewicki
98c14b4f45 chore: add CI for JS, iOS and Android formatting (#1782)
Added CI workflow and local pre-commit hook for formatting and linting the newly added JS, iOS and Android code.
2022-08-16 12:00:32 +02:00
Wojciech Lewicki
77267be5fc feat: support Fabric on Android (#1804)
Most of Android changes for Fabric and bump of FabricExample to RN 0.69.2. iOS and JS changes are available in #1821.
The most notable change on Android is adding methods to components that accept String values of each NumberProp instead of Dynamic. Another change is changed structure of RenderableViewManager.java since we needed to abstract methods that belong only to components inheriting from VirtualView in order to be able to properly override them in their children.
2022-08-12 11:42:44 +02:00
Wojciech Lewicki
8f1bda4856 feat: add Fabric on iOS without ComponentViews (#1821)
Version of #1754 without usage of ComponentViews. It seems like a more proper way, but introduces the necessity of clearing whole state of each component on recycling for it not to be used when view is recycled.

Still known problems:

We stringify props of type NumberProp since codegen only accepts props of a single type. It is the fastest way of dealing with it, but maybe there could be a better way to handle it.
Image resolving should be probably handled the same as in RN core
SvgView needs to set opaque = NO so it is does not have black background (it comes from the fact that RCTViewComponentView overrides backgroundColor setter which in turn somehow messes with the view being opaque). All other svg components do it already so maybe it is not such an issue.
transform prop won't work when set natively since it is not parsed in Fabric
2022-08-11 14:08:11 +02:00
Wojciech Lewicki
7a773654b1 feat: change ios CI (#1831)
Added improved iOS CI jobs
2022-08-10 11:54:21 +02:00
Wojciech Lewicki
286c02fac4 Refactor typescript code (#1806)
Co-authored-by: Eric Butler <eric@codebutler.com>
2022-07-22 17:41:30 +02:00
Wojciech Lewicki
cf808ae79d fix: change ci jobs to main (#1715)
PR changing CI jobs target to main branch since it was changed from develop.
2022-03-02 13:38:23 +01:00
Wojciech Lewicki
bac4986a23 feat: add macos CI (#1704)
PR adding macOS configuration to Example app and adding CI job for building the app on macOS.
2022-02-24 14:44:17 +01:00
Wojciech Lewicki
5b519c1a0c feat: add empty CI job so it runs on PR then (#1705)
Added empty CI job for building macOS so it can be run on the proper PR: #1704
2022-02-24 14:15:42 +01:00
Wojciech Lewicki
bcc9e1dd5f fix: add newlines at the end of files 2022-02-21 17:53:33 +01:00
Wojciech Lewicki
29fbc517b4 fix: change ios to apple 2022-02-21 17:49:07 +01:00
Wojciech Lewicki
eb5543b3e5 feat: add example build workflows 2022-02-21 16:33:40 +01:00
Mikael Sand
0e17501abb chore: update issue template 2020-03-06 10:27:04 +02:00