Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
orientationChangeHandler(dims) {
const { width, height } = dims.window;
const isLandscape = width > height;
this.setState({ isPortrait: !isLandscape });
this.props.navigation.setParams({ hideHeader: isLandscape });
// TODO: Why?
ScreenOrientation.allow(ScreenOrientation.Orientation.ALL);
}
switchToPortrait() {
ScreenOrientation.allow(ScreenOrientation.Orientation.PORTRAIT)
}
componentDidMount() {
ScreenOrientation.allow(ScreenOrientation.Orientation.ALL);
Dimensions.addEventListener(
'change',
this.orientationChangeHandler.bind(this)
);
Analytics.track(Analytics.events.USER_WATCHED_VIDEO);
}
orientationChangeHandler(dims) {
const { width, height } = dims.window
const isLandscape = width > height
this.setState({ isPortrait: !isLandscape })
this.props.onFullscreenchange({ detail: { fullScreen: !!isLandscape, direction: isLandscape ? 'horizontal' : 'vertical' } })
ScreenOrientation.allow(ScreenOrientation.Orientation.ALL)
}