[Solved] What is this block backButtonPressed

Can anyone explain me this block please and tell me how it works thank’s I have a stack navigation

1 Like

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.

2 Likes

@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…

1 Like

no I tried…

1 Like

Hi @Deluxe :wave:

I think that’s caused by this -
(Gestures enabled)
image

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 -

Thanks! :blush:

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.

Example -

  • 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.

Fix -

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 -

image

Screen2 Blocks -

image

This way, we make navigation easy with no navigators :+1: This can be prevented -

Hope I helped you :blush:
Thanks! :blush:

3 Likes

And here is the big question: “Shouldn’t it?” :slight_smile:

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.

K.

1 Like

Ahh hahha yes it’s strange