In React Native, how do you make an interactive tap-and-hold modal like Instagram? - reactjs

Instagram has a really cool interaction where you can tap-and-hold, aka longPress, on an image and an interactive pop-up appears. Once it appears you can drag your finger to one of the action buttons and removing your finger applies the action and closes the pop-up.
Here it is in action.
And here's a link to a video if you need a closer look.
In my app I've got the tap-and-hold popup working, but the finger drag continues to control the underlying View.
How do you get the finger interaction to transfer to the pop-up?
How do you get the buttons responding to finger drag-over?

This is something you can achieve with PanResponder. Using Pan Responder you are basically creating your own touchable components. Click here for the docs.
Also, you would need the Animated API for animating the transitions.

Related

Custom action after tapping a video during the playback or when the playback ends

My use case: I have an image that is the preview of a video. When the user tap the preview, the video should starts a fullscreen playback (I suppose in another Form). When the video ends or when the user tap the video during the playback, the previous Form should be shown. This is the same use case of the question: Codename One landscape oriented Form in a portrait locked app
My question: the MediaPlayer class doesn't seem to expose a method to perform a custom action when pressing the video or when the video ends, like requested by this use case. The MediaPlayer is a peer component, so I'm not sure if trying to use a button as a leader component can make sense to do an action after a tap. Any idea?
Unfortunately media is pretty complicated in that sense. You can either rely on the behavior of the media player natively which handles orientation change, playback etc. seamlessly (seek etc.). Or you can implement everything on your own in a media object in which case you can use native peer overlay and have a transparent component on top of the media view which will grab all the clicks.
The former will provide a more native UX and will auto-rotate the UI but we don't have control since there's no Form underlying the UI. It's shown when you invoke setNativePlayerMode(true). When you tap the video in this case it pauses. To exit playback you would use device native keys e.g. back or a done button and would be returned to the parent Form. Notice that since this is native behavior it acts differently on the device and it's important to do device testing here.
Your alternative is to place a media component in the center of the screen and then you can override everything and customize everything. You can place a layered layout on top and grab all tap events. You will need to add your own progress, play, pause etc. UI elements. The user would need to physically rotate the device as orientation won't switch on its own (for the most part).

How do you build a slide-up panel in React Native, which slides up after you click a button?

See image below to see example - when you click the button, the pane should slide up, and you can then close it by clicking into the map, or sliding it back down.
Used github.com/octopitus/rn-sliding-up-panel to solve this.

Camera customization sencha touch

I'm using the Ext.device.Camera component to take photos in my sencha touch app. I'd like to change some things of this component:
Change the text of the buttons retake and use
Add a button to show the camera roll (The camera roll view is ready, so the button will only change the view)
After the call at success function I would like that the camera won't close and it gives the possibility to the user to take another photo
Thanks
You cant do that from ST2. That's native stuff, if you are wrapping with phonegap/cordova you could create a custom plugin.

In Silverlight, How can I disable Back and Forward navigation using browser buttons?

I'm using the Navigational Framework in Silverlight 4. I'm starting to believe that this was a mistake as the browser buttons are really screwing things up for users. For instance, when a child window is opened the user believes they can close the window by pressing the back button. It doesn't close the window obviously, it just navigates the parent page back a step. The end result is a messed up data set. I'm fed up with the little control I have over the navigation of my application; forward and back buttons are anachronistic. Web applications don't work that way anymore. Please someone tell me how I can disable their functionality; that is, cancel navigation when it is started from one of these buttons.
Remove this code from your html page which holds your silverlight XAP:
<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
This is the history frame.
You will likely have to do this in the actual web/asp.net page, as Silverlight has no real control over the browser.
Some workarounds in this article:
http://lennilobel.wordpress.com/2009/07/26/defeat-the-evil-back-button-in-your-asp-net-applications/

Reacting to StylusDown in control's UI?

I'm building a touch screen application in WPF and I'm wanting to show a change in UI when the user presses a button with their finger/stylus. Currently you only get a flicker of UI change once the finger is released but nothing before that.
I've been trying to hook up triggers and/or eventtriggers in the button template to things like stylusdown and touchdown but to no avail.
I've hooked up some console writes on events attached to a button and they appear in the following order:
StylusDown
StylusButtonDown
TouchDown
StylusUp
StylusButtonUp
Click
All of which firing at the same time when the finger is lifted from the screen. (TouchUp doesn't seem to fire at all).
Any ideas on how I could begin to capture a finger pressing onto a button in the template so I can give the user some idea that they are actually pressing a button?
After blogging in more detail about this issue I had a comment recommending using a SurfaceWindow and then SurfaceButtons from the Surface Toolkit (currently in Beta) and now all is working as I would expect.
Update: The link is now dead. Here's the link to that page from Wayback Machine.

Resources