Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closing a modal window when press the back button #8

Open
PashaArkus opened this issue Jun 5, 2019 · 11 comments
Open

closing a modal window when press the back button #8

PashaArkus opened this issue Jun 5, 2019 · 11 comments

Comments

@PashaArkus
Copy link

How to cancel / disable closing the modal window when you press the back button?

Which platform(s) does your issue occur on?

Android

Please, provide the following version numbers that your issue occurs with:

  • CLI: 5.3.2
  • Cross-platform modules: 5.4.0
  • Runtime(s):
    "tns-ios": {
    "version": "5.2.0"
    },
    "tns-android": {
    "version": "5.3.1"
    }
  • Plugin(s):
    "dependencies": {
    "@nstudio/nativescript-camera-plus": "^2.1.7",
    "axios": "^0.18.0",
    "decode-google-map-polyline": "^1.0.1",
    "http": "0.0.0",
    "moment": "^2.24.0",
    "nativescript-background-http": "^3.4.0",
    "nativescript-bitmap-factory": "^1.8.1",
    "nativescript-camera": "^4.4.0",
    "nativescript-cardview": "^3.1.1",
    "nativescript-carousel": "^4.1.0",
    "nativescript-checkbox": "^3.0.3",
    "nativescript-feedback": "^1.3.9",
    "nativescript-fonticon": "^2.0.0",
    "nativescript-geolocation": "^5.0.0",
    "nativescript-google-maps-sdk": "^2.7.0",
    "nativescript-loading-indicator": "^2.5.1",
    "nativescript-material-activityindicator": "^2.2.15",
    "nativescript-permissions": "^1.3.6",
    "nativescript-phone": "^1.4.0",
    "nativescript-platform-css": "^1.6.6",
    "nativescript-plugin-firebase": "^8.0.1",
    "nativescript-socketio": "^3.2.1",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-ui-gauge": "^3.8.0",
    "nativescript-ui-sidedrawer": "^6.0.0",
    "nativescript-vibrate": "^2.1.3",
    "nativescript-vue": "^2.0.0",
    "nativescript-windowed-modal": "^5.0.6",
    "tns-core-modules": "^5.4.0-next-2019-05-01-141636-02",
    "v-mask": "^1.3.3",
    "vue-i18n": "^8.9.0",
    "vuex": "^3.0.1"
    },
@calebsmithdev
Copy link
Contributor

This is a typical modal, so you wouldn't need to do anything more than this.$navigateBack(), or following the docs from here if you $showModal: https://nativescript-vue.org/en/docs/routing/manual-routing/#showmodal

@PashaArkus
Copy link
Author

So it is, this is a standard modal window, but I cannot stop the standard behavior of the window when I press the back button. The window of simplicity closes, but I need it to not close.
I use the following code to listen to the back button event, but it works only after the user presses the back button when the window is already closed.
if (Platform.isAndroid) { application.android.on(AndroidApplication.activityBackPressedEvent, (data) => { data.cancel = true }); }

@calebsmithdev
Copy link
Contributor

Shoot sorry! I totally read that as you wanted to close the modal. I tried something at one point.. let me see if I can find that in my code somewhere.

@edusperoni
Copy link
Collaborator

Shouldn't this issue be in the Nativescript core repo? Doesn't seem an issue with this plugin specifically.

We actually had a issue where we were using data.cancel = true and it was preventing the closing of modals, so I'm not sure why it's behaving the other way around for you.

@budi7
Copy link

budi7 commented Jun 14, 2019

Hi all...
i'm currently facing the same problem as @PashaArkus. i setted the data.cancel = true and won't prevent modal from closing.

hopefully if you guys want to add this feature, it will be very helpful for some cases. Especially when we need to focus our modal and prevent user from interacting anywhere else except our modal.

@edusperoni
Copy link
Collaborator

Is this issue reproducible without this plugin installed? If so, I'll close this issue and ask you to please open an issue in https://github.com/nativescript/nativescript

@budi7
Copy link

budi7 commented Jun 15, 2019

hi @edusperoni thanks for following up this issue...
i've tested without this plugin, an activityBackPressedEvent is triggered, and sets the data.cancel = true will prevent modal from closing.

I'm using nativescript vue v2 and nativescript v 5.4.1

** reference: NativeScript/NativeScript#6261

@edusperoni
Copy link
Collaborator

We've identified the issue and are working to fix it. We're also thinking about creating a separate showTransparentModal instead of monkey-patching showModal, so there might be a breaking change in the next version

@budi7
Copy link

budi7 commented Jun 19, 2019

I'm gonna looking forward for next version sir. Thank you @edusperoni

@PashaArkus
Copy link
Author

Thank you @edusperoni

@alexonozor
Copy link

@edusperoni longest time! Has this ever been fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants