react-native-search-api
Advanced tools
Comparing version 1.1.0 to 1.2.0
22
index.js
@@ -64,2 +64,24 @@ | ||
/** | ||
* Gets the initial spotlight item's identifier. Resoves to null | ||
* in case the app was started otherwise. | ||
* | ||
* @NOTE A good place for calling this method is the component's | ||
* `componentDidMount` override. | ||
*/ | ||
getInitialSpotlightItem(): Promise { | ||
return SearchApiManager.getInitialSpotlightItem(); | ||
} | ||
/** | ||
* Gets the initial app history item's user info dictionary. Resolves to null | ||
* in case the app was started otherwise. | ||
* | ||
* @NOTE A good place for calling this method is the component's | ||
* `componentDidMount` override. | ||
*/ | ||
getInitialAppHistoryItem(): Promise { | ||
return SearchApiManager.getInitialAppHistoryItem(); | ||
} | ||
/** | ||
* Registers for the spotlight item opening event. | ||
@@ -66,0 +88,0 @@ * |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A React Native module that allows to perform the Spotlight integration on iOS", | ||
@@ -10,0 +10,0 @@ "author": "Daniil Konoplev <danchoys@ombori.com>", |
@@ -48,2 +48,19 @@ # React Native Search Api module | ||
Generally you should be interested whether the app was started using the search, therefore consider using | ||
the following two methods: | ||
```js | ||
// For the spotlight item: | ||
SearchApi.getInitialSpotlightItem().then(result => { | ||
if (result) { | ||
console.log('Started with a spotlight item!') | ||
} | ||
}) | ||
// For the app history item: | ||
SearchApi.getInitialAppHistoryItem().then(result => { | ||
if (result) { | ||
console.log('Started with an app history item!') | ||
} | ||
}) | ||
``` | ||
In order to create a new spotlight item, use `indexSpotlightItem` or `indexSpotlightItems`: | ||
@@ -89,4 +106,18 @@ ```js | ||
Thumbnail to be presented in the search results. The same format as `source` in | ||
the `Image` component. Refer to [documentation](https://facebook.github.io/react-native/docs/image.html). Optional. | ||
the `Image` component. Optional. | ||
Examples: | ||
```js | ||
var localItem = { | ||
<...>, | ||
thumbnail: require('/react-native/img/favicon.png') | ||
}; | ||
var remoteItem = { | ||
<...>, | ||
thumbnail: {uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png'} | ||
}; | ||
``` | ||
Please refer to [documentation](https://facebook.github.io/react-native/docs/image.html) for more details. | ||
### Spotlight-specific keys | ||
@@ -93,0 +124,0 @@ |
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
34501
185
147