The React-Native-LocalSearch
module can solve this.
Without knowing the specific error you are receiving, it may be hard to diagnose it as an error relating to the module or the implementation, but below is how I have it working in my project.
Setup and Implementation
These are the steps to have it properly integrated into your React Native IOS application.
Install: npm install --save react-native-localsearch
Add to project libraries in Xcode. The React Native docs have a detailed pages (with images) on how to do this, but here are some quick steps for it:
- In Xcode's project navigator, right click
Libraries
and Add Files to [your project's name]
.
- Find the directory
React-Native-local-search
in your projects node_modules directory and add RNLocalSearch.xcodeproj
.
- Add
libRNLocalSearch.a
to your project's Build Phases
and Link Binary With Libraries
Use it in component. Example:
var RNLocalSearch = require('react-native-localsearch');
RNLocalSearch.searchForLocations('Location Name', {
latitude: 30.2669444,
longitude: -97.7427778,
latitudeDelta: 0.1,
longitudeDelta: 0.1
}, (err, resp) => {
...
});