Commit Graph
1878 Commits
Author SHA1 Message Date
JanandGitHub 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
fauri13andGitHub 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 PurrerandGitHub 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
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 LewickiandGitHub 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
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]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 LewickiandGitHub 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 AfanasenkoandGitHub 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
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 KafaraandGitHub 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
MichalandGitHub 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öbergandGitHub 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
5b6b555fa2 fix onLayout (#1998)
PR adding proper dispatching of `onLayout` event on both archs by using `eventEmitter`.

Co-authored-by: yonatan.altaraz <yonatan.altaraz@khealth.ai>
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
2023-03-22 14:38:30 +01:00
d03604797f add accessibility and testId props and virtual nodes to support e2e tests tools (#2001)
PR adding accessibility and testId props and virtual nodes to support e2e tests tools and provide general accessibility support.

Co-authored-by: yonatan.altaraz <yonatan.altaraz@khealth.ai>
Co-authored-by: galkahana <gal.kahana@hotmail.com>
2023-03-22 13:01:09 +01:00
Risto KeravuoriandGitHub 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 LewickiandGitHub d6975ea9f2 chore: update Example to newest react-native version (#1999)
PR bumping the Example app to RN 0.71
2023-03-09 11:31:48 +01:00
Wojciech Lewicki 2c59100e24 Release 13.8.0 2023-02-01 11:42:40 +01:00
Wojciech LewickiandGitHub 175a48f8c9 chore: change fabric flag (#1979)
Changed `RN_FABRIC_ENABLED` to `RCT_NEW_ARCH_ENABLED` since it is the current standard for this flag.
2023-01-31 16:15:59 +01:00
Tommy NguyenandGitHub f2f533a292 chore: ensure consistent use of import type (#1971)
We hit issues when building react-native-svg because of inconsistent use of import type. This change adds ESLint result to ensure consistency. I also ran yarn lint --fix to fix up the code.
2023-01-31 14:12:21 +01:00
Wojciech LewickiandGitHub cb87e7510f feat: update FabricExample to 0.71.0-rc.6 (#1962)
PR bumping examples to RN 0.71. For now web Example seems not to load code properly.
2023-01-13 14:19:17 +01:00
Wojciech Lewicki 678940c506 Release 13.7.0 2023-01-09 16:58:43 +01:00
Marlene CotaandGitHub a118c879c7 feat(windows): add example app (#1937)
Added example app for Windows
2023-01-09 12:48:20 +01:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
a21e47d3a1 chore(deps): bump json5 from 2.2.1 to 2.2.3 (#1955)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-04 16:25:45 +01:00
MantasandGitHub 76b742c24a fix: Call onLoad prop in SvgCssUri (#1927)
SvgCssUri calls onLoad if it's passed, just like in PR #1817 (with SvgUri).
2023-01-04 16:18:14 +01:00
Marlene CotaandGitHub 38da5fb67c feat(windows): add clipPath and touch events (#1933)
Adding support for clipPath and touch events.
2023-01-04 15:51:08 +01:00
Wojciech LewickiandGitHub 60fcb0f28f fix: restore black as a default color for svgs (#1947)
PR fixing setting of fill color to black when none is provided to the svg.
2023-01-03 21:15:09 +01:00
1bac96f979 Fix nested SVGs in iOS #1437 (#1948)
PR making the nested svgs parse the references. Originally authored by @tiredBlueWhale.

Co-authored-by: Luca Meyer <lmeyer@Lucas-MacBook-Pro.local>
2023-01-03 20:19:25 +01:00
Wojciech LewickiandGitHub c1808c0978 fix: accept comas in viewbox (#1952)
PR adding support for comas in viewbox property, replacing them with space.
2023-01-03 19:56:54 +01:00
Amit KumarandGitHub 1637580732 Include proguard config (#1842)
This will remove the requirement for people to add the proguard configs themselves. A lot of people first release to production with proguard and then realize why the app crashes. This will solve such issues.

This uses android's consumer proguard setting to enable specific proguard config.
2023-01-03 15:59:10 +01:00
b3dc36ab01 refactor: remove circular dependency (#1929)
When importing the library we have a lot of React Native warning about circular dependency. This PR aims to fix those warnings.

Co-authored-by: Carl-MONNERA <cmonnera@regate.io>
2022-12-08 16:49:30 +01:00
Marlene CotaandGitHub 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 CotaandGitHub 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
Wojciech Lewicki 6182ca3501 Release 13.6.0 2022-11-15 16:11:20 +01:00
Wojciech LewickiandGitHub 70192b233d feat: use transform parsing code from rn core (#1918)
PR changing the custom transform prop parsing algorithm to the one from RN core (facebook/react-native@2eccd59/React/Views/RCTConvert%2BTransform.m), which the current one was most probably taken from.
2022-11-15 14:07:24 +01:00
Wojciech LewickiandGitHub 3f621ae10f chore: bump supported RN version for Fabric (#1913)
PR bumping supported RN version for Fabric since it changed due to https://github.com/software-mansion/react-native-svg/pull/1847 having custom cpp state with linking working only from RN `0.70`
2022-11-15 12:44:48 +01:00
Wojciech LewickiandGitHub 05c33d3245 chore: align examples (#1914)
PR aligning example apps and fixing one bug. On web, if you don't pass a color to the elements, they are rendered with `black` fill. We recreate this behavior in examples, but maybe it should be the default behavior if `fill` is `undefined`. It would probably need to be changed on the native side somehow.

Another fix is to parse `fill` prop in `setNativeProps` since Fabric support has been added and `fill`  prop structure has been changed, it cannot be handled on the native side on `Android` due to complying to interfaces.
Another fix is passing `transform` prop in `Svg` to `G`  when it is not `react-native` style `transform` prop so it is always applied. It creates a problem mentioned in the comment in the code and should be addressed in later PRs.
2022-11-15 12:38:40 +01:00
Wojciech LewickiandGitHub 9c0fa78d72 fix: update supported RN version to 0.64 (#1912)
Based on WoLewicki/libs-rn-version-tester/actions/runs/3410971949/jobs/5674595317 it seems that react-native-svg does not work for projects with RN < 0.64.
2022-11-08 12:10:03 +01:00
Wojciech LewickiandGitHub 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 LewickiandGitHub 18a2f93e40 fix: make svg compile on older versions (#1907)
PR restoring backwards compatibility due to braking changes in method signatures of getViewManagerNames and setHitSlop, lambda expression being available for RN > 0.64(?). Since viewRegistry_DEPRECATED is available from RN 0.65, and its addUIBlock method is available from RN 0.69, and both those things are only really needed on new architecture, we use them only there and stick to the old impl for old arch.
2022-11-07 14:28:43 +01:00
Kacper KapuściakandGitHub 15a62380bd chore: add react-native-svg banner to README (#1909) 2022-11-07 14:23:01 +01:00
Wojciech LewickiandGitHub 1126079425 feat: use codegenNativeComponent to import native views (#1847)
Changed `requireNativeComponent` to `codegenNativeComponent` so that upcoming changes (Static View Configs, Bridgeless Mode and idk what more) in `react-native` are available in the library. Also, types and native components are now taken directly from `fabric` folder to make sure the values passed to the native components are the ones defined in props. It should work on all supported versions since `codegenNativeComponent` function exists from RN v. 0.61.0. Suggested by @RSNara and @cipolleschi

Reason for [`5394bbb` (#1847)](https://github.com/software-mansion/react-native-svg/pull/1847/commits/5394bbbced6c1838e67240997cf4621d7f783197): 
- on `Paper`, `Animated` uses `setNativeProps` method when we set `useNativeDriver`  to `false`, and does not rerender the component. Therefore, new transform lands only in `SvgView` and is parsed in `RCTViewManager.m` .
- on `Fabric`, the same code makes the components rerender. Due to this, information about new transform is passed to the `SvgView` child: `G` , making it apply translations from the transform in its `updateProps` method.
- other than `Animated` use-case, on both archs, if we just passed `transform` prop to `Svg` component, it would end up in double transformations now as well. All of those changes are due to https://github.com/software-mansion/react-native-svg/pull/1895, which added proper parsing of RN style `transform` prop (array of transformations objects) therefore making `G` properly handle `transform` prop passed from `Svg`.

Reason for [`19bcb24` (#1847)](https://github.com/software-mansion/react-native-svg/pull/1847/commits/19bcb2464b3a40a47e4396ea66f49d6a95bfc9bc): Same as https://github.com/software-mansion/react-native-screens/pull/1624
2022-11-03 15:47:29 +01:00
Wojciech LewickiandGitHub 079d069c16 chore: remove formatting from blame (#1905)
Added formatting PR to ignored blame to help navigating through commits.
2022-11-03 15:42:16 +01:00
Wojciech Lewicki b8d408f82f Release 13.5.0 2022-11-02 15:55:14 +01:00
Wojciech LewickiandGitHub f2130ad7cf fix: handle null passed to matrix and tintColor (#1904)
PR adding handling of null values passed to matrix and tintColor props on Android. It should not happen from normal render method, but can still be passed with Animated or Reanimated through native updates or setNativeProps.
2022-11-02 14:54:32 +01:00
Wojciech LewickiandGitHub 8cf4068880 fix: handle null passed to SvgLength (#1903)
SvgLength from method should be able to parse null since it is a correct value, we then use the empty constructor since it provides default values.
2022-10-28 14:59:49 +02:00
Wojciech LewickiandGitHub 6a5242f00b fix: proper transform prop handling (#1895)
PR aligning handling of transform prop between web and native and adding proper handling of transform prop on web.

origin prop is now treated as transform-origin since it seems like the current behavior of this prop on native platforms.
transform prop cannot be an object with transform properties since it does not provide order of transformations which would lead to undefined behavior so this option has been removed.
RN style of transform prop (array of rotation objects) can now be used
font-size on web seems to be 16px by default and it is 12 in library - maybe we should align it somehow
removed maskTransform prop since it does not exist in SVG standard and did nothing on native side
fixed typo in Fabric Pattern updateProps method
2022-10-25 15:55:17 +02:00
Denis SlávikandGitHub 65f373b084 fix: [types] allow Image "href" & "xlinkHref" to be strings (#1896)
Allow 'string' type for href and xlinkHref props in Image component.
Logic in the component allows passing 'string' values to the Image.resolveAssetSource by checking for its type, so it would be nice to reflect it on the properties types as well.
2022-10-21 14:43:37 +02:00