Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getInitialSearchItem return empty initialIdentifier ignore the handleContinueUserActivity value #24

Open
luatnd opened this issue Dec 22, 2020 · 3 comments

Comments

@luatnd
Copy link

luatnd commented Dec 22, 2020

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);
@deepak-ofb
Copy link

This is also returning undefined in my case:
"react-native-spotlight-search": "^2.0.0"
"react-native": "0.64.1"

@jedashford
Copy link
Contributor

null in JS for us also anyone got a fix?

@jedashford
Copy link
Contributor

This is fixed in the PR: #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants