Please provide the following:
- SDK Version: 41
- Platforms(Android/iOS/web/all): IOS
- Add the appropriate “Tag” based on what Expo library you have a question on.
In our app, we have a separate screen to view notifications, soo every notification the user get should be listed here,
My question is, how do we make this screen open by default when the user presses a push notification?
we are using react-navigation to make the screens, and are trying to link to a specific screen using expo-linking.openURL(“ssnAppen/NotificationStack/Notification”)
Our solution worked on Android but not IOS
some of the code
const AppContainer = () => {
responseListener.current =
Notifications.addNotificationResponseReceivedListener((response) => {
Linking.openURL("ssnAppen/NotificationsStack/Notifications");
});
useEffect(() => {
return () => {
Notifications.removeNotificationSubscription(responseListener);
};
}, []);
const linking = {
prefixes: [Linking.makeUrl("/")],
config: {
screens: {
HomeStack: {
path: "HomeStack",
screens: {
Home: "Home",
About: "About",
},
},
NotificationsStack: {
path: "NotificationsStack",
screens: {
Notifications: "Notifications",
},
},
},
},
getStateFromPath(path, config) {
const def = getStateFromPath(path, config);
return def;
},
};
return (
<>
{loaded ? (
<NavigationContainer
ref={navigationRef}
onReady={async () => {
onScreenChange(navigationRef, oldScreenRef);
}}
onStateChange={async () => {
onScreenChange(navigationRef, oldScreenRef);
}}
linking={linking}
>
{state.login == true ? <TabNavigator /> : <RegistrationStackScreen />}
</NavigationContainer>
) : (
)}
</>
);
}
export default function App() {
enableScreens();
return (
<AppContainer />
);
}