Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SVG #9

Open
dai-shi opened this issue Mar 4, 2019 · 7 comments
Open

Support SVG #9

dai-shi opened this issue Mar 4, 2019 · 7 comments

Comments

@dai-shi
Copy link
Owner

dai-shi commented Mar 4, 2019

Since "web" version of svg doesn't work, we need to wait for react-native-svg to support "dom".

software-mansion/react-native-svg#945

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 14, 2019

Well, I implemented by myself. It was way more difficult than I first expected. The major remaining issue is event handlers.

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 14, 2019

@dutzi Probably, you want to try it.

@msand
Copy link

msand commented Oct 19, 2019

Very interesting approach. There's also a web version of react-native-svg now.

@msand
Copy link

msand commented Oct 19, 2019

@dai-shi
Copy link
Owner Author

dai-shi commented Oct 20, 2019

Hey, thanks for coming here.
I'm aware how Expo made react-naive-svg work in RNW.
Unfortunately that approach doesn't work in RND.
RND uses two threads, and the worker thread can't touch DOM...

@msand
Copy link

msand commented Oct 20, 2019

I'm still thinking that it would be easier to map the input props which are coming to react-native-svg to dom in the render(?) thread of RND, than mapping the native properties we're giving to the android and ios native view implementations.

That is, replacing the Tag/type in the jsx ( a bit like the serialization example here: https://github.com/react-native-community/react-native-svg#serialize ), or defining new components which don't transform the input props and styles at all, just pass them over from the worker to the renderer. As we aim to conform as close as possible to the svg support in react-dom/web.

What are the constraints on communication from the worker to the renderer? I haven't looked into RND in detail yet. I would assume it sends json like setNativeProps, or does it allow full Worker.prototype.postMessage?

@dai-shi
Copy link
Owner Author

dai-shi commented Oct 20, 2019

First of all, I might be mistaken.
As far as I understand, in RND we provide a native view implementation like android and ios.
Most of JS code runs in a worker thread, and UI dependent code runs in a main thread in RND that is like mimicking android and ios. RND doesn't modify RN code, I assume.
I don't fully understand your suggestion, but probably that modifies the RN code in react-native-svg, which is something I never thought, so there might be a way.

I agree that my current approach is kind of disaster, so definitely desire a simpler solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants