r/reactnative • • Jul 12 '22

I recreated the magnifying glass effect in React Native

331 Upvotes

25 comments sorted by

18

u/Andrea-Pirlo Jul 12 '22

How does it work in “real life”? ie. On a phone where people don’t use a mouse and use their thumbs to navigate/tap and there’s no such thing as “hover”?

It’s a cool animation, I just can’t see a practical application after a quick look at it at 1am.

1

u/DJYEEZYWORLDPEACE Jul 13 '22

I agree! The only thing I could think of is selecting by releasing which is kind of awkward

4

u/beatgeek Jul 13 '22

So I gather it’s a touch and drag that creates the effect - maybe dragging upwards can be used for selection?

1

u/oVerde Expo Jul 13 '22

I think is a Pan/Drag effect, release or pan/upwards do different things?

1

u/YouGotTangoed Jul 13 '22

My thinking is you would use it in a navigation carousel, to show the current active element

21

u/Stranavad Jul 12 '22

That's cool. Kudos Keep on going

1

u/hafi51 Jul 13 '22

expo or cli?

1

u/DJYEEZYWORLDPEACE Jul 13 '22

I used expo for setting everything up quickly

1

u/hafi51 Jul 13 '22

Did u made a tutorial?

6

u/Sphism Jul 12 '22

That effect was always called a tsunami, until that big tsunami in Thailand in 2004.

2

u/Nick337Games Jul 13 '22

Very cool!

2

u/zetaBrainz Expo Jul 13 '22

Wow looks rly cool

2

u/Astron_AUT Jul 13 '22

I just audibly moaned 🤌

2

u/Guisseppi Jul 13 '22

Repo or it didn’t happened

3

u/beleg_cuth Jul 12 '22

That's pretty cool! Is the code available or how did you do it? The animation is spot on

1

u/stephanr21 Jul 13 '22

How does it look on android? Or are you making this specifically for IOS?

1

u/KyleG Jul 13 '22

Which gesture did you settle on for clicking the expanded icon since your finger is already on the screen to do the drag?

1

u/benjamineruvieru Jul 13 '22

How did you do the video mockup. I have apps I want to show off but I don't know how to do beautiful mock ups like this

1

u/[deleted] Aug 23 '22

Hey - looks great! A question regarding implementation detail: Using PanGestureHandler, how do you come to know what has the current selection? The way I'm doing this currently is quite intensive on the JS thread. I have an onLayout function which just stores the position of elements and onActive method of useAnimatedGestureHandler, I run a for loop to check the position which does not scale very well. Any insight would be really helpful! :)

1

u/rmacd Jul 13 '22

Impressed. Nice work.

-8

u/DJYEEZYWORLDPEACE Jul 12 '22

Follow me on Twitter

2

u/stathisntonas Jul 13 '22

Follow you for what? This has been posted in the past, no source code, just flexing on something useless.

11

u/[deleted] Jul 12 '22

[removed] — view removed comment

3

u/SunMany8795 Jul 14 '22

he won't, probably fake.