ReactNative 监听Android的物理返回事件!
2020-12-22 本文已影响0人
Matsonga
import { Platform, BackHandler } from "react-native";
componentWillMount() {
if (Platform.OS === "android") {
BackHandler.addEventListener("back", this.addListtenRequues);
}
}
componentWillUnmount() {
if (Platform.OS === "android") {
BackHandler.removeEventListener("back");
}
}