Check with npm ls @react-navigation/native
or yarn list @react-navigation/native
. If there is duplication in dependency , for me it was something like
├─ @react-navigation/[email protected]
└─ [email protected]
└─ @react-navigation/[email protected]
so i removed the later and it works now