Using React Native Linking and Firebase to generate dynamic links. Everything is working as it should unless the app is open in the background or "tray" when you click the link. If the app is already open when someone clicks the link it does nothing.
My listener is set up in componentDidMount like the documentation says, but its not firing.
componentDidMount() {
Linking.addEventListener('url', this._handleOpenURL);
},
In fact, I've gone through and alerted componentWillMount(), componentDidMount(), componentWillUpdate(), componentWillUnmount(), componentWillReceiveNewProps(), and _handleOpenURL() and I get nothing when I click the link and it "re-opens" the app from the background? What am I doing wrong?
Figured it out, I'll leave the question in case anyone else has the same issue.
Turns out I just needed to add this code block to my AppDelegate.m file.
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}