I have Reactive Component which passes data from one screen to another..., trying to call second component via Navigate(name,params) method. but it gives an error saying "undefined method is not a method". Copying component code below. Guid me to clear the error.
import React from 'react';
import {
  StyleSheet,
  Text,
  View,
  Pressable,
} from 'react-native';

import { NavigationContainer } from '@react-navigation/native';

export default function ScreenA(navigation:any) {
    const onPressHandler = () => {
        navigation.navigate("Screen_B",{ ItemName: 'Item from ScreenA', ItemId: 12 });
        // navigation.navigate("Screen_B");
    }


React Native Component + Navigation with Paramameters not working error undefined is not a method
Destructure navigation from function parameter:
import React from 'react';
import {
  StyleSheet,
  Text,
  View,
  Pressable,
} from 'react-native';

import { NavigationContainer } from '@react-navigation/native';

export default function ScreenA({navigation}) { // wrap navigation with curly brackets
    const onPressHandler = () => {
        navigation.navigate("Screen_B",{ ItemName: 'Item from ScreenA', ItemId: 12 });
    }

