0

after login success i need to show a message that the operation was successful on the nextpage thanks for help

import {showMessage} from "react-native-flash-message";
import { NavigationContainer ,useFocusEffect} from '@react-navigation/native';

const MainScreen = ({ route, navigation }) => {
    const { userId, email } = route.params;
    useFocusEffect(
        React.useCallback(() => {
            showMessage({
                message: "Welcome mr "+email,
                type: "success",
              });
              
        }, [])

      );
      return(
        <View>
            <Text>aaaa</Text>
        </View>
      )
}

export default MainScreen;

1 Answers1

0

You can use useEffect for this :-

import React, {useEffect} from 'react';
useEffect(() => {
   showMessage({
      message: "Welcome mr "+email,
      type: "success",
   });
 }, []);
varun
  • 89
  • 6