@mappedin/react-native-sdk 5.0.0-beta.3 → 5.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -629,6 +629,59 @@ const App = () => {
629
629
  };
630
630
  ```
631
631
 
632
+ ## Search and Suggestions
633
+
634
+ ```tsx
635
+ import { TextInput } from 'react-native';
636
+ import { MiMapView } from '@mappedin/react-native-sdk';
637
+ import type {
638
+ TBlueDotUpdate,
639
+ MapViewStore,
640
+ MappedinLocation,
641
+ MappedinNode,
642
+ } from '@mappedin/react-native-sdk';
643
+
644
+ // Imperative API
645
+ const mapView = React.useRef<MapViewStore>();
646
+ const [text, setText] = React.useState('');
647
+
648
+ const search = async (text) => {
649
+ const searchResults = await mapView.current.OfflineSearch.search(text);
650
+ // do something with search results
651
+ console.log(searchResults);
652
+ };
653
+
654
+ useEffect(() => {
655
+ const suggest = async (text) => {
656
+ const searchSuggestions = await mapView.current.OfflineSearch.suggest(text);
657
+ // do something with search suggestions
658
+ console.log(searchSuggestions);
659
+ };
660
+ if (text !== '') {
661
+ suggest(text);
662
+ }
663
+ }, [text]
664
+
665
+ const App = () => {
666
+ return (
667
+ <>
668
+ <MiMapView
669
+ style={{ flex: 1 }}
670
+ ref={mapView}
671
+ options={options}
672
+ />
673
+ <View>
674
+ <TextInput
675
+ onChangeText={(text) => setText(text)}
676
+ value={text}
677
+ />
678
+ <Button title="Search" onClick={() => search(setText)} />
679
+ </View>
680
+ </>
681
+ );
682
+ };
683
+ ```
684
+
632
685
  ## Use `react-native-location` to power BlueDot
633
686
 
634
687
  ```tsx