Can anyone explain me this block please and tell me how it works thank’s I have a stack navigation
The block gets triggered when you press the back button on your device. It only works on Android as iOS doesn’t have a physical or on-screen back button.
@Conor just a question, would the “Back” gesture on iOS be the equivalent of this action? Since a few iOS versions, you can swipe from the left of the screen to the right and that works as the “Back” gesture. Just curious…
no I tried…
I think that’s caused by this -
If you have a iOS device, can you please test this?
You just need 2 screens, 1st screen has a button which when clicked, navigates to screen2.
we would test this thing -
Yes it works but let’s say you a list connected and you make changes on the second screen and you swipe right to go back the page will not show the changes I had to add a drawer nav to avoid that people go back like that
Then you should use no navigators - just use navigate to block when open a screen, and the same block in the back pressed event.
- Screen1 - has 1 button, when clicked, navigates to screen2.
- Screen2 - when back pressed, navigates back to screen1.
Bug you’ll notice -
when you come back to screen1 from screen2, and press back on screen1 (there is no block added on screen1 for back press; it’s only on screen2) you will be navigated back to screen2.
Take a back pressed block on screen1, and take a label. make the label invisible, and add a block in back pressed block that is set label text to blank.
Screen1 Blocks -
Screen2 Blocks -
This way, we make navigation easy with no navigators This can be prevented -
Hope I helped you
And here is the big question: “Shouldn’t it?”
I don’t understand your question ?
It was a rhetorical question. Shouldn’t swiping left to go back one screen count as “Back” in the same way tapping on the “Back” button counts as “Back” on Android?
It is also interesting to point out that the latest Android version supports swipe navigation so I assume that Thunkable should count swiping to go back both on Android and iOS as “Back”.
Just thinking out loud.
Ahh hahha yes it’s strange