react native: how to place icon (or view) on image by tap - react-native

I want when I touch the image, at that position will show the icon at the touch position, and maybe when zooming, the icon can be enlarged accordingly. In short, I want the icon to stick at that position, but when the image is zoomed or moved, the icon also zooms or moves.
Also is there any way when we take a picture from the phone to get the exact size of it
i tried by position, but i wonder if there is any way that can be attached to it, i want it to always be in that position no matter what the picture is. Help me

Related

When screen orientation changes, I want only one element to rotate

I'm making an app with react native, expo, bottom-tab-bar navigation package, and expo-screen-orientation package.
The app is for reading some text that is inside some View elements in the middle of the screen, and is controlled with the bottom tab bar.
When I rotate the phone, and change the screen orientation (portrait-landscape), it kind of messes with the UI layout.
What I'd like to achieve, is to only have the View element that contains the readable text to rotate when the phone changes orientation, but the rest of the app (The bottom tab bar, background, buttons, etc.) to stay in the 'portrait' orientation.
What I've tried so far is this:
I've tried to lock the screen to portrait with
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT);
and then listening to orientation changes with eventListeners, Dimentions, useWindowDimentions, and expo-screen-orientation's ScreenOrientation.AddOrientationChangeListener(Listener),
and then maybe rotating the View element manually.
But if the screen is locked and not rotated, the change is not detected.
I've looked but couldn't find an answer.

React Native View Overlay excluding the image portion

I have a screen on which I need to place a transparent round image , the position of the image could be dynamic, I need to render the dynamic view excluding the image with a black overlay colour, such that image and the screen contents below the image remains same... Kind of like when there is an app tutorial , only the required portion is highlighted and the remaining screen is dull..
How can I do it ?

Adding a scrollview and get it to zoom

In my iphone app, you get a UIView with a background image and a "start button".
When you hit the start button, the start button will be hidden, and your background aswell. You will see another image. You will also get a "back button".
You should be able to zoom the image and scroll around.
I want everything on the same UIView.
When you hit the back button, everything should get back to the first background image and the start button, and you should not be able to zoom or scroll.
How can I do this? And is it possible at all to hide a scroll view in order to just show a regular screen, in the same view?
Thanks in advance!
EDIT: Ok, I know how to hide the scroll view now, but when the scroll view is shown, you can't scroll! I have made the scroll view bigger than the screen and put a label below the "original screen". How to get it to scroll?
Add a UIScrollView to the main view in which you have the zoom/scrollable image. Simply remove it when the back button is pressed.

Grid view with background image horizontal scrolling

I'm trying to implement a grid view menu, with horizontal background scroll of three images triggered by swipe gesture, so only the background images are scrolled while icons remain still. I investigated AQGridView, GMGridView, OHGridView, but they seem to not include this feature, so I decided to implement my own grid view with custom buttons placed in grid formation. My doubts are how to implement the background image scroll. I have searched for different solutions, but I'm not able to figure out how to solve it.
Many thanks
If I understand your question correctly you could make a view with 2 subviews: a) the grid of icons (UIImageView) and b) a scroll view with your background images in paging mode (UIScrollViewController).
Just make sure your icons do not receive touches, so that the scrollview gets the touches.
If you want to make the icons tap-able, then it's a little more complicated; you could create an invisible layer on top and then manually handle the touches, which will get complicated. Or, what I would do, place the icons as subviews on the plain scrollview, and then move the icons in the equal and opposite direction that the scrollview is moving in to create the illusion that the icons are standing still, this will simplest to implement but is a bit of a hack. Mathematically speaking you want to apply a transformation to the scrollview and apply the opposite transformation to the icons which are in the scrollview's coordinate system so that in the global coordinate system (the screen) your icons do not move.

Paging Horizontally with vertical scroll on each page!

In my app I use a page control and a UIScrollView to page horizontally, I'd like to be able to enable vertical scrolling on each page. Now I know you can nest UIScrollViews in order to achieve this, there is however one problem in my project. Each of the pages uses a view controller consisting of a view, with a background image (different image for each page). This background image should not move while scrolling up and down.
Now what I want is the ability to have buttons, regular rect buttons, which I create in Interface Builder (since I want to be able to design and update the positions easily) and which then can be scrolled vertically.
So it should be like this:
You see a screen with a page-control on the bottom, above it an image with buttons over it. When you scroll sideways, you go to another page, again with an image (another one) and with different buttons. Now whenever you scroll vertically on a page, the buttons should be scrollable (so I can have a LOT of buttons on 1 page), but the image should maintain it's position.
So I figured, I just add another scroll view on top of the view with the background image. This works fine since I now have my buttons hovering over the background image and I have a separate nib file for each page including the buttons. But when I do it like this, the scrollview with the buttons becomes un-scrollable vertically. I don't know why this is happening, so could anyone suggest me how to achieve the wanted result?
I'd be really really grateful!
Thanks,
Fabian