Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(rn) adapt to new BackHandler eventing API
JPL4dcc4b37115f
diff --git a/react/features/base/react/components/native/SlidingView.tsx b/react/features/base/react/components/native/SlidingView.tsxindex 1137b8f4fa..98dbf382cf 100644--- a/react/features/base/react/components/native/SlidingView.tsx+++ b/react/features/base/react/components/native/SlidingView.tsx@@ -70,6 +70,11 @@ interface IState {* A generic animated slider view to be used for animated menus.*/export default class SlidingView extends PureComponent<IProps, IState> {+ /**+ * Initializes hardwareBackPress subscription.+ */+ _hardwareBackPressSubscription: any;+/*** True if the component is mounted.*/@@ -120,7 +125,7 @@ export default class SlidingView extends PureComponent<IProps, IState> {* @inheritdoc*/override componentDidMount() {- BackHandler.addEventListener('hardwareBackPress', this._onHardwareBackPress);+ this._hardwareBackPressSubscription = BackHandler.addEventListener('hardwareBackPress', this._onHardwareBackPress);this._mounted = true;this._setShow(this.props.show);@@ -145,7 +150,7 @@ export default class SlidingView extends PureComponent<IProps, IState> {* @inheritdoc*/override componentWillUnmount() {- BackHandler.removeEventListener('hardwareBackPress', this._onHardwareBackPress);+ this._hardwareBackPressSubscription?.remove();this._mounted = false;}diff --git a/react/features/conference/components/native/Conference.tsx b/react/features/conference/components/native/Conference.tsxindex 6de79e2a82..5c131238ec 100644--- a/react/features/conference/components/native/Conference.tsx+++ b/react/features/conference/components/native/Conference.tsx@@ -180,6 +180,11 @@ class Conference extends AbstractConference<IProps, State> {*/_expandedLabelTimeout: any;+ /**+ * Initializes hardwareBackPress subscription.+ */+ _hardwareBackPressSubscription: any;+/*** Initializes a new Conference instance.*@@ -216,7 +221,7 @@ class Conference extends AbstractConference<IProps, State> {navigation} = this.props;- BackHandler.addEventListener('hardwareBackPress', this._onHardwareBackPress);+ this._hardwareBackPressSubscription = BackHandler.addEventListener('hardwareBackPress', this._onHardwareBackPress);if (_audioOnlyEnabled && _startCarMode) {navigation.navigate(screen.conference.carmode);@@ -258,7 +263,7 @@ class Conference extends AbstractConference<IProps, State> {*/override componentWillUnmount() {// Tear handling any hardware button presses for back navigation down.- BackHandler.removeEventListener('hardwareBackPress', this._onHardwareBackPress);+ this._hardwareBackPressSubscription?.remove();clearTimeout(this._expandedLabelTimeout.current ?? 0);}diff --git a/react/features/prejoin/components/native/Prejoin.tsx b/react/features/prejoin/components/native/Prejoin.tsxindex f4a5779f92..e0dc6a18e6 100644--- a/react/features/prejoin/components/native/Prejoin.tsx+++ b/react/features/prejoin/components/native/Prejoin.tsx@@ -109,14 +109,13 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {const { PRIMARY, TERTIARY } = BUTTON_TYPES;useEffect(() => {- BackHandler.addEventListener('hardwareBackPress', goBack);+ const hardwareBackPressSubscription = BackHandler.addEventListener('hardwareBackPress', goBack);dispatch(setPermanentProperty({wasPrejoinDisplayed: true}));- return () => BackHandler.removeEventListener('hardwareBackPress', goBack);-+ return () => hardwareBackPressSubscription.remove();}, []); // dispatch is not in the dependency list because we want the action to be dispatched only once when// the component is mounted.