one
Version:
One is a React framework for web, iOS, and Android apps.
42 lines (39 loc) • 1.61 kB
JavaScript
import { Platform } from "react-native";
import { NitroModules } from "react-native-nitro-modules";
import { rethrowNativeError } from "../nativeError.native.js";
import { MapServices as MapServices$1 } from "./unavailable.native.js";
var hybrid;
function native() {
hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject("OneMapServices");
return hybrid;
}
function search(query, center) {
var radiusMeters = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 5e3;
return native().search(query, center, radiusMeters).catch(rethrowNativeError);
}
function autocomplete(query, center) {
var radiusMeters = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 5e3;
return native().autocomplete(query, center, radiusMeters).catch(rethrowNativeError);
}
function resolveSuggestion(id) {
return native().resolveSuggestion(id).catch(rethrowNativeError);
}
function directions(origin, destination) {
var transport = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "driving";
return native().directions(origin, destination, transport).catch(rethrowNativeError);
}
var nativeMapServices = Object.freeze({
search,
autocomplete,
resolveSuggestion,
directions
});
var androidMapServices = Object.freeze({
search: nativeMapServices.search,
autocomplete: MapServices$1.autocomplete,
resolveSuggestion: MapServices$1.resolveSuggestion,
directions: MapServices$1.directions
});
var MapServices = Platform.OS === "android" ? androidMapServices : nativeMapServices;
export { MapServices };
//# sourceMappingURL=index.native.js.map