Hi,
I am using Linking.getInitialURL() for deeplinking.but it is not being cleared after used .deeplink particular page is going correctly after that i move someother page and click again the app ,it will go to the again deeplinking particular page bcoz of the getinitialURL not clear.
If there any idea for clear Linking.getInitialURL() .
This is my code:
function renderScreens() {
const [appState, setAppState] = useState(AppState.currentState);
const [URL, setUrl] = useState(null);
useEffect(() => {
const subscription = AppState.addEventListener(
"change",
handleAppStateChange
);
return () => {
subscription.remove();
};
}, [appState]);
const handleAppStateChange = (nextAppState) => {
Linking.getInitialURL().then((url) => {
if (url ) {
setUrl(Object.values(url));
} else {
setUrl(null);
}
});
Linking.addEventListener("url", (url) => {
if (Object.values(url) != null) {
setUrl(Object.values(url));
} else {
setUrl(null);
}
});
if (appState != nextAppState) {
if (
appState.match(/inactive|background/) &&
nextAppState === "active"
) {
}
setAppState(nextAppState);
}
};
return(
if (URL!=null && appState=='active'){
navigatecorrectpage
}
)