Commit Graph

11 Commits

Author SHA1 Message Date
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
Tommy Nguyen
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
Carl MONNERA
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
Wojciech Lewicki
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)](5394bbbced): 
- 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)](19bcb2464b): Same as https://github.com/software-mansion/react-native-screens/pull/1624
2022-11-03 15:47:29 +01: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
286c02fac4 Refactor typescript code (#1806)
Co-authored-by: Eric Butler <eric@codebutler.com>
2022-07-22 17:41:30 +02:00
Douglas Lowder
64c3c9f79c fix: Fix ts types (#1628) 2021-08-13 10:58:20 -07:00
Mikael Sand
f0cd11d6f6 perf: optimize svg root prop handling, simplify element development
This change allows modifying the element code without causing it to load
the native components more than once, making live-reload usable.
2020-01-18 19:00:33 +02:00
Mikael Sand
c0ffc65609 chore: refactor props and styles extraction 2019-12-09 21:28:02 +02:00
Mikael Sand
f389a1a753 feat: expose native components 2019-09-09 20:21:53 +03:00
Mikael Sand
4f3e34e556 refactor: typescript 2019-09-09 05:44:29 +03:00