在React Native中的componentWillUnmount中执行异步任务?

时间:2016-07-11 13:18:31

标签: reactjs react-native

我想在卸载React Native中的组件之前断开蓝牙设备的连接。断开连接是异步完成的。以下方法不会断开设备。我怎样才能使它工作?

我想这与断开连接异步的事实有关。

componentWillUnmount(){
   BluetoothManager.disconnect(device); // working properly in other contexts.
}

0 个答案:

没有答案