danielsogl / awesome-cordova-plugins

Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support.
https://danielsogl.gitbook.io/awesome-cordova-plugins/
Other
2.41k stars 2.42k forks source link

Bug: Navigating to a page from the callback function of the native BLE connect method renders the ion-segment component inoperable on the target page #2149

Closed dgoosse closed 3 years ago

dgoosse commented 6 years ago

Ionic version: (check one with "x") (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [x ] 3.9.2 [] 4.x

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request

Please do not submit support requests or "How to" questions here. Instead, please use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior: Navigating to a page from the callback function from the native BLE connect() method renders the ion-segment component inoperable on the target page.

Expected behavior: The ion-segment component should continue to work as expected after navigating.

Steps to reproduce: I've provided an ionic3 application that reproduce the problem. Simply deploy the application on ionic DevApp on an android device then on the home page simply press scan for BLE devices then press the connect button on any discovered device to navigate to the DevicePage that demonstrates the problem. Thanks!

Related code:

Here is the application: https://github.com/dgoosse/show

connect(device: any) {
    this.scanning = true;
    console.log("connecting to " + device.name);
    this.ble.connect(device.id).subscribe(device => this.onConnected(device), error => this.onConnectedError(error));
  }

  onConnected(device: any) {
    this.scanning = false;
    this.device = device;
    console.log("connected to " + device.id);
    this.navCtrl.push('DevicePage', { "device": device });
  }

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v6.11.5
    npm  : 5.4.2
    OS   : macOS High Sierra

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy
dgoosse commented 6 years ago

Please can someone have a look at this problem as it is seriously limiting the use of the BLE native plugin with Ionic as you can't navigate to other pages when connecting to a device. Thanks a lot :)