Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

disable back button in react native

import React, {Component, useEffect} from 'react';
import {
    View,
    Text,
    BackHandler,
} from 'react-native';

const LogInView = () => {

    useEffect(() => {
      const backHandler = BackHandler.addEventListener('hardwareBackPress', () => true)
      return () => backHandler.remove()
    }, [])

    return (
        <View>
            <Text>Back button example</Text>
        </View>
    );
}

export default LoginView
 
PREVIOUS NEXT
Tagged: #disable #button #react #native
ADD COMMENT
Topic
Name
8+8 =