Is it possible to add onPress event to svg graphic which was loaded from file in React Native? - react-native

In my React Native application I need to load a svg graphic from a file and add onPress events to suitable svg elements based on element ids. I want to ask if it is possible in React Native?
To add the svg file I plan to use the solution form react-native-svg (https://www.npmjs.com/package/react-native-svg#use-with-svg-files).

Related

How do you move the position of components like text in react native?

I'm coding in React Native and I want to move text positions and images without using bottom, top, left and right. These components only work for my screen only and will align incorrectly on other devices. Can someone show me how to move the components to custom positions on my app?
without seeing your code or how you are using it my first suggestion would be to try and use padding. But here's a list of layout props in React Native https://reactnative.dev/docs/layout-props

Using custom gif as a loading icon within <ActivityIndicator> using react-native

I am currently attempting to code an app in react native for an android device. I have created a custom loading component and am using the to show a loading icon.
But, I want to use a custom gif loading icon that contains my app's colours. I have looked but I cannot seem to find anything, is it possible to do this?
react native does not support gif feature in its raw form. However, in order to reach what you want and use gifs in the application, you can take a look at the accepted answer on the subject;
How do I display an animated gif in React Native?
Then all you need to do is to use Image component instead of ActivityIndicator. And passing the relevant gif information to the image component.

How to center a react native svg with flex?

How would I use flex to center an svg within a View in react native?
Here is an expo snack that centers an svg by its origin parameters.
Do I need to hardcode origin parameters, place the svg in a View with a flex property, and then export it as a component?
Does svg care about flex?
A related but distinct SO question:
How to center an SVG in React Native?
-> From this answer, should I convert my shape-based svg into a path xml tag? That doesn't seem like the right answer here.
I would rather define svgs inline than import svg files.

Display keyboard in react native

In html I can make a division or a span editable, similarly is it possible that I can make a View or any other component except Text Input editable in React Native.

How to react to SVG events in React Native?

Prelude to the Question:
I am planning to create a super simple SVG editor in React Native, with the following features:
add a new circle to the SVG
resize the circle
move the circle around
remove the circle.
What is not clear, how can I react to SVG events in React Native. (Is an SVG event the same as a DOM event (for React Native) ?)
I Googled "svg editor react native", "svg react native events" and I found:
https://github.com/magicismight/react-native-svg, it seems that it does not have support for events.
https://github.com/brentvatne/react-native-svgkit , also, does not support events yet (has it as plan though).
The Question:
If the user taps or drags the circle in an SVG, how can I react to that event in React Native?
EDIT1:
Further Googling indicates that SVG is not supported in React Native (yet).
Would it be easier to just use SVG + ReactJS + Cordova to accomplish this goal (i.e. write a simple SVG editor using React and deploy it to a mobile phone)?
EDIT2:
After some more Googling, it seems that http://reapp.io/ is the simplest way to go.
https://github.com/magicismight/react-native-svg, it seems that it does not have support for events.
It sure does, e.g.
<Circle cx={10} cy={10} r={20} onPress={()=>{console.log('pressed')}}/>
Check the PanResponder example for more complex touch handling such as dragging.
After some more googling, it seems that http://reapp.io/ is the simplest way to go.
But from what I can tell that isn't React-Native, right?