Skip to content

LinkingIOS.addEventListener("url", callback) not getting passed url #861

@stuartlynn

Description

@stuartlynn

I am trying to implement callbacks for URL triggering of the app while its running as described here (https://facebook.github.io/react-native/docs/linkingios.html#content). I have added

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString    *)sourceApplication annotation:(id)annotation {
    return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}

to AppDelegate.m and have included

componentDidMount:function() {
    LinkingIOS.addEventListener('url', this._handleLoginCallback);
},
componentWillUnmount: function() {
  LinkingIOS.removeEventListener('url', this._handleLoginCallback);
},
_handleLoginCallback: function(event) {
   console.log(event)
},

To one of my react components. When the URL is opened in the app the handleLoginCallback function is triggered as expected but event is an empty hash.

When I set breakpoints in the objective-c code I can see the url being passed correctly all the way through to RTCEventDispatcher#sendDeviceEventWithName but it doesn't seem to be making it through the bridge to the javascript code.

This is using react-native version 0.3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions