Skip to content

getInitialSearchItem return empty initialIdentifier ignore the handleContinueUserActivity value #24

Description

@luatnd

Hi, this lib comes in handy, but I struggle with a bug:

I just debug the case:

self.initialIdentifier has value in handleContinueUserActivity:

self.initialIdentifier = uniqueItemIdentifier; // set break point here and got the correct value
- (void)handleContinueUserActivity:(NSUserActivity *)userActivity {
    NSString *uniqueItemIdentifier = userActivity.userInfo[CSSearchableItemActivityIdentifier];
    
    if (!uniqueItemIdentifier) {
        return;
    }

    self.initialIdentifier = uniqueItemIdentifier;
    
    if (!self.hasListeners) {
        return;
    }
    
    [self sendEventWithName:kSpotlightSearchItemTapped body:uniqueItemIdentifier];
}

But self.initialIdentifier became nil here:

RCT_EXPORT_METHOD(getInitialSearchItem:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
    resolve(self.initialIdentifier);
}

It leads to undefined on JS:

SpotlightSearch.getInitialSearchItem().then(console.log);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions