Gestures receiving parameters and forwarding to a function
See original GitHub issueCan I pass some object to the function inside of a gesture just like this?
<StackLayout.GestureRecognizers> <TapGestureRecognizer Command="{Binding Source={x:Reference View}, Path=BindingContext.ItemTappedCommand}" CommandParameter="{Binding .}" /> </StackLayout.GestureRecognizers>
gesture in Fabulous
gestureRecognizers =[ View.TapGestureRecognizer(command=(fun (param) -> dispatch PushPage ("ServantDetail",param))) ]
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Forwarding a gesture to superview - ios
When you create your gesture, make the target the superview, and call the method in the superview for the action, something like:
Read more >In SwiftUI, how can I perform a gesture but forward ...
Here is a demo of possible approach. Tested with Xcode 11.4 / iOS 13.4 struct ContentView: View { var body: some View {...
Read more >Hand Gesture Controlled Presentation | OpenCV Python
Get Started with ClearML for free: https://clear.ml/ Download Code and Files: ...
Read more >Use TalkBack gestures - Android Accessibility Help
TalkBack gestures help you navigate and perform frequent actions on your Android device. Single-finger & multi-finger gestures. Single-finger gestures are ...
Read more >How Android 12 lets you control your phone with facial ...
These operations include: go to the next actionable screen object, select an object, go to the previous object, touch and hold, scroll forward, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you set the GestureRecognizer on the FlexLayout, you won’t be able to identify a specific child because you’re really listening for the FlexLayout.
What you can do though is to set one TapGestureRecognizer on each children.
Better yet would be to pass your “page parameter” as a parameter to your
servantImageFrame
function so you can directly usegestureRecognizers
in that function.Thank you @TimLariviere, it worked!
I changed the pushpage message
type Msg = | PushPage of (string * Servant)
the update
| PushPage (page,servant) -> { model with PageStack = Some page :: model.PageStack;Servant = servant}, Cmd.none
and the gesture
for i in servants do yield (servantImage i.Image).GestureRecognizers([ View.TapGestureRecognizer( command = fun () -> dispatch (PushPage ("ServantDetail",i)) // here, you have access to the current item ) ])