Commit Graph

2145 Commits

Author SHA1 Message Date
Jakub Grzywacz
490d09e229 chore: fabric macos example CI (#2579)
# Summary

Fix `fabric-macos-example` CI 

## Test Plan

Ci should be green
2024-12-16 14:26:52 +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
Boaz Arad
d49783040d fix: currentColor stale value (#2573)
# Summary
This is another fix for issue
https://github.com/software-mansion/react-native-svg/issues/2566 that
also resets the color on prepareForRecycle (in the same manner of this
fix https://github.com/software-mansion/react-native-svg/pull/2570). I
also don't have a sandboxed reproduce, but was able to verify the fix on
my company's code which I unfortunately can't share.

## Compatibility
OS | Implemented
-- | --
iOS | 
MacOS | 

Co-authored-by: Jakub Grzywacz <jakub.grzywacz@swmansion.com>
2024-12-16 12:18:51 +01:00
Jakub Grzywacz
596ba83454 remove: *.metal from podspec source_files (#2576)
# Summary

Fixes #2571.
Since filter shaders are already provided as compiled `*.metallib`
files, there is no need to include `*.metal` files in the `source_files`
list.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
2024-12-12 11:49:19 +01:00
Jakub Grzywacz
d3d61a5fc1 feat: custom shadow nodes (#2568)
# Summary

Implement custom shadow nodes for nearly all `Svg` components. While
it's a foundation for numerous upcoming changes, it currently addresses
and resolves #2544.

## Test Plan

There shouldn't be any noticeable changes, and everything should
function as before, except that `onLayout` will now be triggered only
once and with the correct dimensions.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
| Android |          |

---------

Co-authored-by: Jakub Piasecki <jakubpiasecki67@gmail.com>
2024-12-12 11:48:46 +01:00
Jakub Grzywacz
bf1c32d9a5 feat: add codegen ios.componentProvider (#2572)
# Summary

Add a newly introduced field `ios.componentProvider` to the `codegen`
configuration to create an association map between JS components and
their native implementations.

When this field is defined, it is used and codegen don't crawl the file
system looking for the mapping. You can find the documentation for it
here:
https://github.com/facebook/react-native-website/pull/4388/files#diff-7fbb6ff2e58f8bd50d2763e551c63e1816adb6d593f40d489785b575b0e82718R76

## Test Plan

Running `pod install` in the `tests-example` will currently hang and
eventually crash, as it attempts to crawl through the entire repository.
2024-12-10 17:03:47 +01:00
Jakub Grzywacz
856142eb25 fix: currentColor overflow (#2570)
# Summary  

This is a blind fix for issue #2566 that resets the caller on
`prepareForRecycle`. While it should help address the overflow happening
in some cases, I cannot guarantee that it will fully resolve the issue
due to the lack of a reproducible scenario.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
2024-12-10 11:15:27 +01:00
Jakub Grzywacz
de6b4d0d17 chore: bump TestsExample to react-native@0.77.0-rc.1 (#2556)
# Summary

Bump TestsExample to `react-native@0.77.0-rc.1` to track compatibility
with the latest version

## Test Plan

`TestsExample` should compile.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| Android |          |
2024-12-09 16:33:53 +01:00
Abed El Rahman Al Tawil
d1e91144a7 refactor: use old style switch statement in FeCompositeView.java (#2562)
Use old-style switch statement in `FeCompositeView.java`.
2024-12-06 16:34:49 +01:00
Jakub Grzywacz
c59eb295db Release 15.10.1 2024-12-05 11:41:55 +01:00
Jakub Grzywacz
488613562b fix: do not parse id as number in any case (#2563)
# Summary

When using `SvgXml` or `SvgCss`, an `id` attribute gets converted into a
`number` instead of a `string`, which causes a crash because the native
side expects a string value.

```js
import {SvgXml} from 'react-native-svg';
import {SvgCss} from 'react-native-svg/css';
```

## Test Plan

This example should not crash:
```jsx
import {SvgCss} from 'react-native-svg/css';

const svgXml = `
<svg width="100" height="100" viewBox="0 0 100 100">
  <filter x="0%" y="0%" width="100" height="100" id="0123456789">
    <feFlood flood-color="red" />
  </filter>
  <circle cx="50" cy="50" r="50" filter="url(#0123456789)" />
</svg>
`;

function Example() {
  return <SvgCss xml={svgXml} />;
}
```
2024-12-05 11:15:32 +01:00
Jakub Grzywacz
3b5c5f0593 Release 15.10.0 2024-12-03 12:54:54 +01:00
Jakub Grzywacz
1c9a553db0 fix: FeComposite add default value for k1...4 (#2557)
# Summary

Fixes #2552 by adding default value for k1, k2, k3, k4 according to the
spec: https://www.w3.org/TR/SVG11/filters.html#feCompositeElement

> If the attribute is not specified, the effect is as if a value of 0
were specified.

## Test Plan

[Repro from issue
2552](https://github.com/TomCorvus/RNSVG/blob/main/App.js)

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
2024-12-02 13:32:51 +01:00
Ignacy Łątka
01db444f51 feat: make RenderableView.hitTest public to create a cross-library interface (#2555)
<!-- 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

Adding an `RNGH <-> RNSVG` interface requires usage of
`RenderableView.hitTest` to work.
([link](https://github.com/software-mansion/react-native-gesture-handler/pull/3242))
Currently, `RenderableView.hitTest` is `package-private`, meaning it
cannot be accessed by other packages.
This change does not change any functionality of the library, it only
exposes existing functions to other libraries.

I only made public those `hitTest` implementation which are strictly
necessary for this interface, this is why multiple, if not most
`hitTest` implementations remain `package-private` despite the changes
made in the PR.

## Test Plan

- open the example app, see how the app builds successfully

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

- `RNSVG`'s `paper-example` app

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

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
| Android |          |
| Web     |          |

## Checklist

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

- [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-11-28 17:05:43 +01:00
Jakub Grzywacz
2dcc8324b6 refactor: replace deprecated processTransform (#2554)
# Summary

Replace deprecated `TransformHelper.processTransform` with a new
function that also gets `transformOrigin`.

## Test Plan

Transforms should function properly, and this error should not occur
during the build process:
```
> Task :react-native-svg:compileDebugJavaWithJavac
/react-native-svg/apps/paper-example/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:390: warning: [removal] processTransform(ReadableArray,double[]) in TransformHelper has been deprecated and marked for removal
    TransformHelper.processTransform(transforms, sTransformDecompositionArray);
                   ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
```

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-11-28 15:29:45 +01:00
Jakub Grzywacz
c617dec1c5 fix: animated transform last frame (#2553)
# Summary

When using the Animated API for animations, it sends the last frame as
JavaScript-parsed (matrix) updates in addition to native (transform)
updates. ~~As a result, we need to ignore one of them.~~ I believe
there's no need to differentiate between native and JavaScript
updates—we can simply save both to the same value (mMatrix). By doing
so, we can avoid duplicating the transforms.

| Before | After |
|--------|--------|
| <video
src="https://github.com/user-attachments/assets/868cc778-4b88-4473-85b5-9665b4b241aa">
| <video
src="https://github.com/user-attachments/assets/c6d17b7b-7c9a-47c3-8286-2d9b5720f261">
|




## Test Plan

```jsx
import React, {useEffect} from 'react';
import {Animated, useAnimatedValue, View} from 'react-native';
import {Rect, Svg} from 'react-native-svg';

const AnimatedRect = Animated.createAnimatedComponent(Rect);
function AnimatedJumpIssue() {
  const animatedValue = useAnimatedValue(100);
  return (
    <>
      <View style={{borderColor: 'black', borderWidth: 1}}>
        <Svg height="100" width="400">
          <AnimatedRect
            x="0"
            y="0"
            width="100"
            height="100"
            fill="black"
            transform={[{translateX: animatedValue}]}
          />
        </Svg>
      </View>
      <Button
        title="Press me"
        onPress={() => {
          Animated.timing(animatedValue, {
            toValue: 200,
            duration: 3000,
            useNativeDriver: true,
          }).start();
        }}
      />
    </>
  );
}
```

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
| iOS |          |
| macOS |          |
2024-11-28 12:44:55 +01:00
Jakub Grzywacz
d125be1819 fix: getBBox size (#2549)
# Summary

When calling `getBBox` on rect, it will not give correct dimensions as
`markers` that are 90% `CGRectZero` so CGRectUnion between some values
and (0, 0, 0, 0) will return (0, 0, width, height)

## Test Plan

```tsx
import React, { useRef } from 'react';
import { Button, View } from 'react-native';
import { Rect, Svg } from 'react-native-svg';

function App(): React.JSX.Element {
  const ref1 = useRef<Rect>(null);

  return (
    <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
      <Svg width={300} height={300}>
        <Rect
          x={100}
          y={100}
          width={100}
          height={100}
          fill="red"
          opacity={0.5}
          ref={ref1}
        />
      </Svg>
      <Button
        title="Press me"
        onPress={() => console.log(ref1.current?.getBBox())}
      />
    </View>
  );
}

export default App;
```

Before: return `{"height": 100, "width": 100, "x": 0, "y": 0}`
After: return `{"height": 100, "width": 100, "x": 100, "y": 100}`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
2024-11-21 10:37:54 +01:00
Jakub Grzywacz
d1d936a834 fix: resolve transforms on new architecture (#2542)
# Summary

Add `resolveTransforms` on `updateProps` to get correct matrix. It will
improve animating transformations, as Animated/Reanimated skips JS
`processTransform` and passes transformations directly.

## Test Plan

Animate `transform` prop in react-native style.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
2024-11-20 10:42:39 +01:00
Jakub Grzywacz
74b77a672e fix: react-native@0.73 sourceSet to maintain support (#2543)
# Summary

#2541 is not compatible with `react-native@0.73`. This PR introduces
sourceSet to maintain support for that version.

## Test Plan

Build app with `react-native@0.73.x`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-11-19 13:54:39 +01:00
Pieter De Baets
81e4692885 feat: update SvgPackage to supported stable API's (#2541)
Address some deprecated API's in SVGPackage

# Summary

This improves compatibility with future React Native releases, which
will remove TurboReactPackage and the ReactModuleInfo constructor used.

## Test Plan

CI
2024-11-19 10:02:49 +01:00
Jakub Grzywacz
e85c727b79 chore: fix paper-macos-example workflow (#2539)
# Summary

Regenerate pods to fix `paper-macos-example` workflow.
`fabric-macos-example` will still fail as it doesn't have any startup
command, but it's not our fault.

## Test Plan

CI for `peper-macos-example` should be green
2024-11-19 09:55:05 +01:00
Jakub Grzywacz
0c30339c55 refactor: use old style switch statement (#2538)
# Summary

Use old-style switch statement.
Closes #2537
2024-11-18 10:43:17 +01:00
Jakub Grzywacz
08b1f53147 fix: remove fill and stroke when its unset (#2536)
# Summary

Closes #2535
When `fill` or `stroke` is set to `'none'` we should remove the value
instead of keeping the last valid value.

## Test Plan

```tsx
import React, {useState} from 'react';
import {Text, TouchableOpacity} from 'react-native';
import {Path, Rect, Svg} from 'react-native-svg';

function Example() {
  const [color, setColor] = useState('#0000FF');
  return (
    <>
      <Svg width={120} height={150} viewBox="0 0 12 15" fill="none">
        <Path
          d="M1 3.353C1 2.053 2.053 1 3.353 1H8.647C9.947 1 11 2.053 11 3.353V13.207C11 13.3008 10.9736 13.3927 10.9238 13.4722C10.874 13.5518 10.8029 13.6157 10.7185 13.6567C10.6341 13.6976 10.5399 13.7141 10.4466 13.7041C10.3533 13.694 10.2648 13.658 10.191 13.6L7.202 11.25C6.99452 11.0876 6.7385 10.9995 6.475 11H3.353C2.72895 11 2.13045 10.7521 1.68918 10.3108C1.2479 9.86955 1 9.27105 1 8.647V3.353Z"
          stroke={color}
          fill={color}
          strokeOpacity={0.5}
          strokeWidth={1.5}
        />
      </Svg>
      <TouchableOpacity onPress={() => setColor('none')}>
        <Text>Click to remove color</Text>
      </TouchableOpacity>
    </>
  );
}
```

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| macOS   |          |
2024-11-15 13:13:36 +01:00
Andrew Coates
d02c997352 fix: react-native-windows implementation for new architecture (#2527)
# Summary
There are two main things going on with the PR. Both involve a reworking
of the new arch implementation of rn-svg for windows.
The current implementation attempts to implement a svg renderer from
scratch. There are numerous edge cases that it wasn't handling
correctly, and the performance had some serious issues. This
implementation switches to use the svg rendering path built into
Direct2D. This brings significant performance improvements.

The 2nd issue is there have been various breaking changes in
react-native-windows for how new arch native components are implemented.
This brings the rn-svg implementation in line with those latest changes.

## Test Plan

Primary testing right now is loading up the example app in the repo.
New arch on react-native-windows is still in somewhat early days - so
there are not really current users of this code. I am integrating this
code into Microsoft Office, where I have tested some scenarios. But we
will get expanded testing as we roll out the new arch. I expect there to
be some follow-ups as we expand our usage. The version of rn-svg before
this PR doesn't build with the latest new arch react-native-windows
versions. - So its hard to get worse than that.

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

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

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    N/A  |
| MacOS   |    N/A      |
| Android |    N/A      |
| Web     |          |

## 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-11-15 12:17:12 +01:00
Jakub Grzywacz
6aff3094ce fix: filters memory leak on apple (#2534)
# Summary

While animating filters, I discovered a memory leak due to not releasing
the `CGImage` after creating the mask.

## Test Plan

```tsx
import {useEffect} from 'react';
import Animated, { useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
import Svg, {FeOffset, Filter, Rect} from 'react-native-svg';

const AnimatedFilter = Animated.createAnimatedComponent(Filter);
const AnimatedFeOffset = Animated.createAnimatedComponent(FeOffset);
const AnimatedRect = Animated.createAnimatedComponent(Rect);
export default function Example() {
  const offset = useSharedValue(0.5);

  useEffect(() => {
    offset.value = withRepeat(withTiming(300, {duration: 3000}), -1, true);
  }, []);

  return (
    <Svg height="300" width="300">
      <AnimatedFilter id="filter">
        <AnimatedFeOffset dx={offset} dy={offset} result="offOut" />
      </AnimatedFilter>
      <AnimatedRect
        x="0"
        y="0"
        width="300"
        height="300"
        fill="red"
        filter="url(#filter)"
      />
    </Svg>
  );
}
```

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| macOS   |          |
2024-11-15 12:00:12 +01:00
Jakub Grzywacz
bba8b3f0a8 Release 15.9.0 2024-11-13 14:22:18 +01:00
Jakub Grzywacz
1256d561df fix: react-native-macos@0.76+ (#2531)
# Summary

On `react-native-macos` 0.76, `UIGraphicsBeginImageContextWithOptions`
and some other UIGraphics directives were removed so the temporary
solution is to copy the removed functions here.

More details
here https://github.com/software-mansion/react-native-svg/issues/2528
and here https://github.com/microsoft/react-native-macos/pull/2209

Closes #2528

## Test Plan

Built the `fabric-macos-example` for with `react-native-macos@0.76.0`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| MacOS   |          |

## Checklist

- [x] I have tested this on a device and a simulator
2024-11-13 12:30:05 +01:00
Jakub Grzywacz
d0530e4b9f fix: add default FeBlend mode (#2530)
# Summary

Fixes #2529
`FeBlend` should have default blend mode set to `normal`

## Test Plan

Test case specified in #2529

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-11-12 14:37:46 +01:00
Omeid
38186e8283 fix: apple bounding box (CGPathGetPathBoundingBox) (#2177)
<!-- 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

As per the spec, bbox should not include any transformations, including
scaling. It should also not include any control points. This fixes
getBBox to give correct results matching Google Chrome, Firefox as per
the spec.


* What issues does the pull request solve? Please tag them so that they
will get automatically closed once the PR is merged
* What is the feature? (if applicable)
Bug fix.

* How did you implement the solution?
Like this, see.

* What areas of the library does it impact?
getBBox API.

## Test Plan

I build some stuff that works with SVG, the results on web were
inconsistent, and digging down I realise it was a react-native-svg.

Some fun fact, there was a surprisingly similar bug related to very
confusing named (CGPathGetBoundingBox vs CGPathGetPathBoundingBox) APIs
in Firefox some years ago as well.
https://bugzilla.mozilla.org/show_bug.cgi?id=1369904


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

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

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |         |
| Android |   🔘#   |
| Web | 🔘 *|

* Depends on the host platform. But works fine in major browsers.
# will create a follow up PR. Currently getBBox on Android doesn't
account for scaling properly.

## 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: Omeid Matten <omeid@kemene.com>
2024-11-07 10:39:01 +01:00
Jakub Grzywacz
29d4c7c37b fix: update warnUnimplementedFilter list (#2525)
# Summary

Closes #2523
Since `FeBlend`, `FeComposite`, `FeDropShadow` and `FeFlood` is already
supported (see: #2362) we should remove it from
`warnUnimplementedFilter` list
2024-11-04 13:12:37 +01:00
Jakub Grzywacz
cceeb2b30a chore: fix web-example app path and format examples (#2524)
# Summary

A minor change in web example app to fix SVG path and reformat examples
with prettier/lint
2024-11-04 12:57:30 +01:00
Jakub Grzywacz
2a58016ec1 feat: get currentColor from caller instead of parent (#2521)
# Summary

Fixes #2520
When an element uses `currentColor`, it should look for color in its
caller, not in its parent.
Example: 
```svg
<Svg width="100" height="100" viewBox="0 0 100 100" color="red">
  <Defs color="blue">
    <G color="green">
      <Rect id="a" x="0" y="0" width="50" height="50" fill="currentColor"/>
    </G>
  </Defs>
  <G color="pink">
    <Use href="#a"/>												<!-- #1 -->
  </G>
  <Use href="#a" transform="translate(25 25)"/>						<!-- #2 -->
  <G color="green">
    <Use href="#a" transform="translate(50 50)"/>					<!-- #3 -->
  </G>
</Svg>
```

* `#1` should be **pink**
* `#2` should be **red**
* `#3` should be **green**


![image](https://github.com/user-attachments/assets/b7ba2ec6-ea05-4bcb-9f40-0cf024e5c749)

## Test Plan

Example app -> test -> Test2520

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| MacOS   |          |
| Android |          |
2024-10-31 16:00:36 +01:00
Jakub Grzywacz
405ff97eea chore: update bundler to 2.5.22 (#2522)
# Summary

Update ruby bundler to 2.5.22 to fix failing CI

## Test Plan

CIs will not fail on ruby version
2024-10-31 09:36:49 +01:00
Jakub Grzywacz
c6af6b447d docs: add Empty screen as playground (#2517)
# Summary

Create Empty screen with blank svg in example app as playground
Additionally add FeDropShadow icon as i forgot about it.
2024-10-28 17:12:35 +01:00
Jakub Grzywacz
fd9397c1f9 fix: FeComposite in2 on Android (#2516)
# Summary

While working on
https://github.com/software-mansion/react-native-svg/pull/2514 I've
noticed a bug in `FeComposite` on Android that `in2` was ignored

## Test Plan

Run Example app -> filters -> FeComposite on Android

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-10-28 15:01:19 +01:00
Jakub Grzywacz
eb4889c000 fix: negative dx/dy in feOffset (#2515)
# Summary

While working on #2514 I've noticed that negative dx/dy were treated as
positive.

## Test Plan

Add FeOffset filter with negative dx/dy to an element. It should move
closer to upper left corner.

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-10-28 14:55:22 +01:00
Jakub Grzywacz
e6a27f8a3d feat: FeDropShadow (#2514)
# Summary

Continuation of #2362 introducing highly requested  `FeDropShadow` 
filter. This addition is straightforward since it's essentially a
shorthand (as specified in the spec) for filters that are already
implemented: https://www.w3.org/TR/filter-effects-1/#feDropShadowElement

<img width="532" alt="image"
src="https://github.com/user-attachments/assets/b221ee4c-d8b0-469b-acb0-71224fb2b1e0">

## Test Plan

Example app -> Filters -> FeDropShadow

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| macOS   |          |
| Android |          |
| Web     |          |
2024-10-28 14:44:36 +01:00
Jakub Grzywacz
36ca5c4584 fix: client rect on use element (#2513)
# Summary

Use elements had incorrect `clientRect` based on templates' rect, which
was incorrect. With this change, it ensures client rect is based on path
transformed by CTM.

## Test Plan

Example app -> Filters -> FeComposite

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-10-28 13:45:52 +01:00
Jakub Grzywacz
8e865a9bdb fix: create symlink to common directory (#2512)
# Summary

After changing project structure, local images stopped displaying on
Android. This is due to the fact that React Native on Android uses
okhttp for requests, which modifies the endpoint "by cleaning up the
wrong part" from
`http://10.0.2.2:8081/../common/example/assets/image.jpg`
to
`http://10.0.2.2:8081/common/example/assets/image.jpg`

A quick fix for this is to create a symlink to the common directory,
allowing images to be resolved without the `../` segment.

Special thanks to Kudo for sharing the original workaround here:
https://github.com/facebook/metro/issues/322#issuecomment-445642199.
2024-10-25 19:59:44 +02:00
Jakub Grzywacz
cc527dfd49 fix: example apps metro paths (#2511)
# Summary

Fixes paths in Metro config
2024-10-25 19:27:23 +02: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
36aecda8c6 fix: example types (#2508)
# Summary

Fixes small mistake introduced in #2507
2024-10-25 16:20:30 +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
a1be06cbfd chore: upgrade react native in example apps (#2506)
# Summary

Update all examples to `react-native@0.76.0`
2024-10-25 14:32:57 +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
19c7ff8310 chore: set yarn version (#2504)
# Summary

Similar to
https://github.com/software-mansion/react-native-gesture-handler/pull/2882
Sets the package manager used in the example apps and in the root of the
repository to yarn@1.22.22.

## Test Plan

Install dependencies & build apps
2024-10-25 11:38:59 +02:00
Łukasz Kosmaty
a1705f13bc chore: Remove legacy version check in react-native.config.js (#2503)
## Description

Removes legacy version check from `react-native.config.js`. 

## Changes

The community CLI is no longer a dependency for React Native, meaning it
may not be installed in every project. For example, projects that use
Expo won't include the `@react-native-community/cli-*` packages.
Consequently, this check will fail, leading to issues with autolinking
components.

This version check can be removed safely, as the 9th version of the CLI
was released two years ago.

## Tests

This change was tested using `expo` project on react native `0.76`.

Co-authored-by: Jakub Grzywacz <jakub.grzywacz@swmansion.com>
2024-10-25 11:28:22 +02:00
Jakub Grzywacz
4637dee1e4 feat: FeComposite filter (#2433)
# Summary

<img width="324" alt="image"
src="https://github.com/user-attachments/assets/0a9b4a56-d093-49f7-aacd-c198ee00f256">

## Test Plan

Examples app -> Filters -> FeComposite

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |          |
| macOS   |    *      |
| Android |          |
| Web     |          |

_*_ macOS isn't working as:
* `CGBitmapContextCreateImage` always returns null
* FeFlood isn't aligned properly (will be fixed in the following PR)
2024-10-25 11:18:07 +02:00
Jakub Grzywacz
525d09ef34 chore: remove screens and RNS from macos example app (#2502)
# Summary

For some reason, someone installed `react-native-screens` and
`react-native-safe-area-context` into macOS example app. This PR removes
it, so CI should pass now.
2024-10-23 13:56:56 +02:00