react-native-spotlight-search
react-native-spotlight-search copied to clipboard
getInitialSearchItem return empty initialIdentifier ignore the handleContinueUserActivity value
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);
This is also returning undefined in my case: "react-native-spotlight-search": "^2.0.0" "react-native": "0.64.1"