Skip to content

Commit

Permalink
Merge pull request #42818 from skyweb331/onboarding-dismiss
Browse files Browse the repository at this point in the history
Block Onboarding modal dismiss on android
  • Loading branch information
rlinoz authored Jun 19, 2024
2 parents 3c56ee2 + d4deb6b commit e0ff35b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/pages/OnboardingPurpose/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import React from 'react';
import {useFocusEffect} from '@react-navigation/native';
import React, {useCallback} from 'react';
import {BackHandler} from 'react-native';
import BaseOnboardingPurpose from './BaseOnboardingPurpose';
import type {OnboardingPurposeProps} from './types';

function OnboardingPurpose({...rest}: OnboardingPurposeProps) {
// To block android native back button behavior
useFocusEffect(
useCallback(() => {
// Return true to indicate that the back button press is handled here
const backAction = () => true;

const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);

return () => backHandler.remove();
}, []),
);

return (
<BaseOnboardingPurpose
shouldUseNativeStyles
Expand Down

0 comments on commit e0ff35b

Please sign in to comment.