Commit Graph
142 Commits
Author SHA1 Message Date
Wojciech LewickiandGitHub 91f6bd1fa9 chore: bump Examples to 0.72 (#2084)
Bump Example and FabricExample to RN 0.72
2023-07-05 22:46:42 +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
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
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 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
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
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 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 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 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
Lenz Weber-TronicandGitHub afaf500db9 make reanimated work in web (#1886)
Up until now, trying to use reanimated with react-native-svg in react-native-web resulted in an error.
This adds a setNativeProps function to the web implementation to directly modify the transform and style props on a SVGElement ref.

Since there is a need to track the "last merged props" and those need to be reset on every render, the render method has been moved into the WebShape class and a tag string property has been added.

As g had some extra handling for x and y, a prepareProps function was added as well.
2022-10-13 14:07:20 +02:00
Wojciech LewickiandGitHub 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 LewickiandGitHub 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 LewickiandGitHub 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 LewickiandGitHub 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 LewickiandGitHub 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
286c02fac4 Refactor typescript code (#1806)
Co-authored-by: Eric Butler <eric@codebutler.com>
2022-07-22 17:41:30 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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
Wojciech LewickiandGitHub 68de5f8170 Update README.md 2022-04-27 15:26:35 +02:00
dependabot[bot]andGitHub 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]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 LewickiandGitHub 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
Mathieu ActhernoeneandGitHub 2fa9645cf6 Add web example (#1717)
Added web example to `Example`
2022-03-07 12:16:50 +01:00
Wojciech LewickiandGitHub 2484baa8db feat: move Example to TS (#1712)
This PR changes all examples in Example app to ts in order to more easily check if types are correct and in future remove index.d.ts file.
2022-03-01 14:35:53 +01:00
Wojciech LewickiandGitHub 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 14c1124e6f fix: try add gradle-wrapper 2022-02-22 10:16:43 +01:00
Wojciech Lewicki 522c2e31f8 chore: add Example to repo 2022-02-21 16:17:37 +01:00
Mikael Sand a9f425f306 fix: remove example submodule 2019-08-27 18:09:22 +03:00
Mikael Sand cc77c83956 Update Example reference 2018-02-12 01:34:50 +02:00
Horcrux cc38ce3b57 Add example as submodule 2017-01-18 13:58:51 +08:00
Horcrux 80647727bd Remove example 2017-01-18 13:52:19 +08:00
Horcrux da32b1bb96 Temp commit 2016-11-05 18:42:49 +08:00
Horcrux ed2da1b364 Merge branch 'master' into text-refactor 2016-09-17 21:06:33 +08:00
Horcrux d549f6ca9c clean up unused code 2016-09-17 09:49:28 +08:00
Horcrux a0005fadbd fix eslint warning 2016-09-14 19:47:26 +08:00
Horcrux 699ec64807 update gradle and ESLint related dependencies 2016-09-14 19:40:04 +08:00
Brent Vatne 3d4974942a Make the example project compatible with Exponent and publish it 2016-09-13 21:02:28 -07:00
Horcrux 68b91bb12c update example react-native version to 0.33.0 2016-09-13 10:48:54 +08:00
Horcrux bd26c04a1d first step of TSpan 2016-08-30 09:37:38 +08:00
Horcrux 001835b7c1 fix crash when the text letter reaches the end of text-path 2016-08-26 10:15:59 +08:00
Horcrux 4251854948 fix #118
fix #118 and change peerDependencies
bump to 4.2.0
2016-08-26 09:25:51 +08:00
Horcrux 9f5b1a26bb never setState after component is unmounted 2016-08-24 18:03:53 +08:00
Horcrux 371cf51b0d bump version to 4.1.5 2016-08-24 17:40:32 +08:00
Horcrux 69a94d0fc3 remove unnecessary comments 2016-08-24 11:59:25 +08:00
Horcrux c9a64c44fc update example`s react-naitve version to 0.31.0 2016-08-19 16:02:05 +08:00
Horcrux d1afb78da0 Add preserveAspectRatio prop for Image
Add preserveAspectRatio prop for Image.
Fix touch events for Image on Android.
Fix viewBox slice bug on Android.
2016-08-13 14:03:08 +08:00
Horcrux e747cc82a6 Add support to base64 data from svg
use `svgRef.toDataURL(function (base64) {console.log(base64);});` to get
base64 data of svgRef
2016-08-12 11:13:27 +08:00