|
|
@@ -14,7 +14,11 @@ export default class SearchV2 extends Component {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
isSearch: false,
|
|
|
- searchResult: [{id:0}]
|
|
|
+ searchResult: [{id:0}],
|
|
|
+ latlng: {
|
|
|
+ lat: 0.00001,
|
|
|
+ lng: 0.00001
|
|
|
+ }
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -28,13 +32,16 @@ export default class SearchV2 extends Component {
|
|
|
lat: location.coords.latitude,
|
|
|
lng: location.coords.longitude
|
|
|
}
|
|
|
+ this.setState({
|
|
|
+ latlng: latlng
|
|
|
+ })
|
|
|
this.searchStation(latlng);
|
|
|
}, error => {
|
|
|
console.warn("getGeoLocation", error);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- searchStation(latlng) {
|
|
|
+ searchStation(latlng, time=2000) {
|
|
|
this.setState({
|
|
|
isSearch: true
|
|
|
});
|
|
|
@@ -62,8 +69,7 @@ export default class SearchV2 extends Component {
|
|
|
isSearch: false,
|
|
|
searchResult: list
|
|
|
});
|
|
|
- }, 3000);
|
|
|
-
|
|
|
+ }, time);
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
console.log('err', err);
|
|
|
@@ -102,7 +108,7 @@ export default class SearchV2 extends Component {
|
|
|
this.searchWorld = text;
|
|
|
}}
|
|
|
onSubmitEditing={() => {
|
|
|
- this.getGeoLocation();
|
|
|
+ this.searchStation(this.state.latlng, 1000);
|
|
|
}}/>
|
|
|
</View>
|
|
|
{ this.state.isSearch
|