2163 Commits

Author SHA1 Message Date
Wojciech Lewicki
3a04189df8 fix: reanimated on old architecture (#1869)
PR adding option for `Double` for all props that were of type `NumberProp` on `Android` so `reanimated` works the same as before on old architecture. It also introduces the change of how `fill` and `stroke` should be constructed for options not going through `render` method, e.g. `react-native-reanimated`. An example of how to handle it can be seen in the provided example: https://github.com/react-native-svg/react-native-svg/pull/1869/files#diff-76a76277daf14518270e8aea8a5e9358a8215d7e4276d2e5f1c4fe95107cdc20
2022-09-15 12:08:57 +02:00
Wojciech Lewicki
ee6e5da195 feat: transfer specs to ts and remove unnecessary props (#1865)
PR transfering Fabric specs to TS, removing unnecessary @ReactProp adnotations, unifying inheritance hierarchy across platforms, adding custom types for color and image source props so they are parsed by react-native.
2022-09-14 12:01:35 +02:00
Wojciech Lewicki
f16a08f40f fix: restore bitmap recycling on children changes (#1864)
PR fixing the regression introduced in #1844. In that PR we set mRemovedFromReactViewHierarchy after one of SvgView's children has been removed, resulting in not being able to update it after one of the components in its hierarchy has been removed. In this PR the behavior has been changed, now we subscribe to startViewTransition which should be called only by react-native-screens when the screen starts its removal animation. It should still work for old issues as well as the new ones.
2022-09-14 11:03:48 +02:00
Wojciech Lewicki
992cf19a68 chore: bump examples to rn 0.70 (#1858)
PR bumping Example and FabricExample apps to rn 0.70.
2022-09-06 15:32:00 +02:00
Wojciech Lewicki
2d4489360d fix: remove FabricEnabledViewGroup (#1851)
PR removing FabricEnabledViewGroup since it was only needed for custom state which is not used in react-native-svg.
2022-09-06 12:08:16 +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
67755288c0 Release 13.1.0 2022-08-29 17:39:47 +02:00
Wojciech Lewicki
57ea716475 fix: bitmap nulled before screen transition (#1844)
This PR fixes the issues in `react-native-screens` and probably other libraries using native `Fragments` for transitions on Android (see https://github.com/software-mansion/react-native-screens/issues/773). It moves the recycling and setting `mBitMap` to `null` to `onDetachedFromWindow` when the view is removed from `react` view hierarchy. `invalidate` is not always the proper place for doing it since the native view can still be visible for the user after the `invalidate` is called (see this comment with video: https://github.com/software-mansion/react-native-screens/issues/773#issuecomment-769418173).
2022-08-26 16:03:54 +02:00
Wojciech Lewicki
b3618eff40 fix: setters for old react native versions (#1846)
On old react-native versions (e.g. 0.64.4), property setters on Android were handled differently, which resulted in calling Dynamic setters for e.g. fill, matrix and stroke prop. Since JS code has been changed, the props on the native side look a bit different. It lead to bugs in mentioned props, which was not spotted since the code was tested only on the newer versions of react-native, where new view managers are used and props do not resolve in Dynamic setters.
2022-08-26 14:45:18 +02:00
Tomek Zawadzki
8f0f649d2d Use angle-bracket imports (#1848)
This PR replaces bad double-quotes imports (which break Swift interop) with good angle-bracket imports.
2022-08-26 14:41:18 +02:00
Wojciech Lewicki
fdc6ca69bf fix: make svg invalidate after props update (#1843)
Previous method definition resulted in not overriding the base method so after the props update, SvgView was not invalidated and redrawn.
2022-08-23 10:36:04 +02:00
Wojciech Lewicki
0313f0cc07 Release 13.0.0 2022-08-17 16:42:35 +02:00
Wojciech Lewicki
a69cf7651d Update README.md 2022-08-17 16:35:11 +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
f1fa606664 Release 12.4.4 2022-08-10 12:52:22 +02:00
Wojciech Lewicki
7a773654b1 feat: change ios CI (#1831)
Added improved iOS CI jobs
2022-08-10 11:54:21 +02:00
Robert Sasak
4062c2e2b8 Add support for translateX and translateY on web (#1825)
Props translateX and translateY are ignored on web. This PR is addressing it the same way as it is already done for originX and originY.

This PR is not addressing the issue of transform as stated in issue.
2022-08-10 10:27:35 +02:00
Wojciech Lewicki
b00579a957 fix: export types from lib which were available before (#1829)
Exported all types from lib/extract/types.tsx since most of them were available before refactor done in #1806.
2022-08-09 15:45:17 +02:00
tainakanchu
6d1110b9c0 feat: fix broken enum declaration (#1819)
After #1800 merged, the refactoring 286c02f was performed and enum declaration was back to previous one.
So type error mentioned at #1210 for maskUnits should occurred again.
2022-08-09 14:20:33 +02:00
Hyo
8d0ae5e04e Fix constructor with deprecated context (#1822)
The constructor with context is deprecated and occurs types error in react-native@69+.
2022-08-09 14:08:07 +02:00
Wojciech Lewicki
34ece786b3 Release 12.4.3 2022-07-26 17:56:13 +02:00
Wojciech Lewicki
24cfaabe33 Add onLoad method to SvgUri (#1817)
Co-authored-by: Harvey Connor <harvey@smartguide.com.au>
2022-07-26 17:47:12 +02:00
Wojciech Lewicki
c87f823bf0 fix: remove tsignore in LocalSvg and provide correct types (#1816)
PR adding proper typings for asset prop of LocalSvg based on Image.resolveAssetSource() typings. Based on #1593 by @pratyushok.
2022-07-26 16:50:42 +02:00
Wojciech Lewicki
af68c93d04 add missing onLayout prop typings (#1815)
onLayout prop typings are missing. This PR simply adds missing onLayout prop to svg nodes.

Co-authored-by: Sergey Tshovrebov <sinxwal@gmail.com>
2022-07-26 16:03:38 +02:00
Wojciech Lewicki
9c1a8b1f71 fix: correctly export rest of the props and add onError to parsing (#1814)
PR correctly exporting rest of the props and adding onError to parsing in other Svg components.
2022-07-26 15:27:56 +02:00
Ollie
82717e656a fix style attribute space (#1639)
When the svg code has some blank in style attribute,like this style="white-space: pre; "
it was throw an error Cannot read property 'trim' of undefined.
2022-07-26 15:20:48 +02:00
Wojciech Lewicki
0722eedf2f Release 12.4.2 2022-07-26 12:05:45 +02:00
Wojciech Lewicki
556690e9f1 fix: types from lib folder (#1813)
Added missing component props and made Svg* component props extend SvgProps. Also removed custom Color type which is now just ColorValue from react-native.
2022-07-26 12:02:48 +02:00
Wojciech Lewicki
de84df64ba Release 12.4.1 2022-07-25 17:29:29 +02:00
Wojciech Lewicki
06ac3491d1 feat: update readmes (#1716)
PR refactoring the READMEs, removing outdated information and adding, removing CHANGELOG.md generated by semantic-release, moving usage of the library to USAGE.md.
2022-07-25 17:04:03 +02:00
Zidane Hammouda
1cbf24922d Fixed some vocabulary issues in Contributing file (#1765)
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
2022-07-25 16:05:08 +02:00
Moser José
c84b34535c update the readme for npm (#1523)
Co-authored-by: Moser José <moser.jose@outlook.com>
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
2022-07-25 12:29:41 +02:00
DominicTobias
211acf0040 Fix Stop.tsx error TS2612: Property 'props' will overwrite the base property in 'Component<StopProps, {}, any>' (#1777) 2022-07-25 12:10:43 +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
tainakanchu
a7a31ca806 Change enum declaration in index.d.ts to UnionType (#1800)
Co-authored-by: Avery Pierce <avery.pierce@spin.pm>
2022-07-22 15:31:47 +02:00
Wojciech Lewicki
1a752999d9 Release 12.4.0 2022-07-15 12:51:41 +02:00
dependabot[bot]
05b3f28a84 chore(deps): bump async from 2.6.3 to 2.6.4 in /Example (#1759)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-15 12:21:13 +02: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
TikiTDO
4d3c521a22 Do not include build artifacts in the npm package (#1786)
* Fixes #1785
2022-07-14 17:14:48 +02:00
Stephen Pittman
2a44346049 Fix many JS vulns, fix tests (#1775)
* fix: lint problem

* fix: ignore malformed JSON file for FlowJS

* fix: add missing @types/jest package

* chore: update TypeScript version

* chore: update all eslint deps

Includes updating and installing missing/wrong peer deps

* chore: update all Jest deps

* chore: replace Jest config with jest.config.ts

* fix: make root Jest tests ignore Example folders

* chore: update css-select dep

* chore: update css-tree to latest 1.x version

2.x broke tests so left a 1.x

* chore: upgrade ansi-regex to close JS vuln

* chore: upgrade ejs to close JS vuln

* chore: upgrade async to close JS vuln

* chore: upgrade simple-plist to close JS vuln
2022-07-14 16:25:55 +02:00
Sanjeeban Mukhopadhyay
1dc42ea8a8 Fixed Typo (#1789) 2022-07-14 15:37:28 +02:00
Wojciech Lewicki
68de5f8170 Update README.md 2022-04-27 15:26:35 +02:00
Wojciech Lewicki
86f0be17fb Update README.md
Removed `Looking for maintainers` and added `Example` app to README.
2022-04-27 15:25:40 +02:00
dependabot[bot]
cf3d817a2b chore(deps): bump ansi-regex from 4.1.0 to 4.1.1 in /Example (#1750)
bump some more deps from dependabot
2022-04-12 16:26:06 +02:00
dependabot[bot]
84e307433b chore(deps): bump many deps with dependabot
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-12 14:50:25 +02:00
Wojciech Lewicki
1b01381f28 feat: remove extractColor in favor of RN impl (#1726)
PR removing extractColor.ts in favor of using the processColor implementation straight from react-native. It should handle all the cases from the previous implementation and the cases with PlatformColor and DynamicColorIOS. Normally we would just send the returned value to the native side, but in react-native-svg, e.g. fill prop can have more values than just color, e.g. currentColor. Because of it, we cannot use UIColor on iOS, NSColor on macOS and customType="Color" on Android as a prop type there and therefore we need to prepare the custom values on the JS side. It is done by passing the prop as an array with specific first element. In case of colors, it is 0. (hopefully I understood the code right).
2022-04-12 13:47:21 +02:00