|
@@ -19,6 +19,7 @@ import {
|
|
|
findNodeHandle,
|
|
|
UIManager,
|
|
|
StatusBar,
|
|
|
+ BackHandler,
|
|
|
Button,
|
|
|
DeviceEventEmitter
|
|
|
} from "react-native";
|
|
@@ -262,10 +263,35 @@ export default class SchedulePage extends BasePage {
|
|
|
}
|
|
|
|
|
|
componentWillMount() {
|
|
|
- // BackAndroid.addEventListener("hardwareBackPress", this.onBackAndroid);
|
|
|
+ BackHandler.addEventListener(
|
|
|
+ "hardwareBackPress",
|
|
|
+ this.onBackAndroid.bind(this)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ componentWillUnmount() {
|
|
|
+ BackHandler.removeEventListener(
|
|
|
+ "hardwareBackPress",
|
|
|
+ this.onBackAndroid.bind(this)
|
|
|
+ );
|
|
|
}
|
|
|
onBackAndroid() {
|
|
|
- alert("返回");
|
|
|
+ if (this.state.isFull) {
|
|
|
+ Orientation.lockToPortrait();
|
|
|
+ this.setState({
|
|
|
+ // title_height: "6%",
|
|
|
+ video_frame_height: "32%",
|
|
|
+ // seat_height: "2%",
|
|
|
+ // flatlist_height: "60%",
|
|
|
+ x: this.state.videoImage_x,
|
|
|
+ y: this.state.videoImage_y,
|
|
|
+ video_width: this.state.videoImage_width,
|
|
|
+ video_height: this.state.videoImage_height,
|
|
|
+ statusbar_hidden: false,
|
|
|
+ isFull: false
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ }
|
|
|
}
|
|
|
onError() {
|
|
|
alert("播放器异常");
|
|
@@ -281,10 +307,7 @@ export default class SchedulePage extends BasePage {
|
|
|
if (!this.state.isFull) {
|
|
|
Orientation.lockToLandscape();
|
|
|
this.setState({
|
|
|
- // title_height: "0%",
|
|
|
video_frame_height: "100%",
|
|
|
- // seat_height: "0%",
|
|
|
- // flatlist_height: "0%",
|
|
|
statusbar_hidden: true,
|
|
|
isFull: true,
|
|
|
x: 0,
|
|
@@ -295,10 +318,7 @@ export default class SchedulePage extends BasePage {
|
|
|
} else {
|
|
|
Orientation.lockToPortrait();
|
|
|
this.setState({
|
|
|
- // title_height: "6%",
|
|
|
video_frame_height: "32%",
|
|
|
- // seat_height: "2%",
|
|
|
- // flatlist_height: "60%",
|
|
|
x: this.state.videoImage_x,
|
|
|
y: this.state.videoImage_y,
|
|
|
video_width: this.state.videoImage_width,
|