Open danieltanasec opened 2 years ago
I'm noticing the same on my end.
I've got the same issue
It happen because the index.d.ts
was typed incorrectly.
I fixed by create this patch react-native-launch-navigator+1.0.8.patch
using patch-package
diff --git a/node_modules/react-native-launch-navigator/index.d.ts b/node_modules/react-native-launch-navigator/index.d.ts
index ae97e78..f6e67e8 100644
--- a/node_modules/react-native-launch-navigator/index.d.ts
+++ b/node_modules/react-native-launch-navigator/index.d.ts
@@ -3,7 +3,10 @@
// Definitions by: Dave Alden <https://github.com/dpa99c>
// Usage: import { LaunchNavigator, LaunchNavigatorOptions } from 'react-native-launch-navigator';
-export interface LaunchNavigatorOptions {
+declare module 'react-native-launch-navigator' {
+ type APP_KEYS = "APPLE_MAPS" | "GOOGLE_MAPS" | "WAZE" | "CITYMAPPER" | "NAVIGON" | "TRANSIT_APP" | "YANDEX" | "UBER" | "TOMTOM" | "BING_MAPS" | "SYGIC" | "HERE_MAPS" | "MOOVIT" | "LYFT" | "MAPS_ME" | "CABIFY" | "BAIDU" | "TAXIS_99" | "GAODE";
+
+ export interface LaunchNavigatorOptions {
/**
* name of the navigation app to use for directions.
@@ -57,9 +60,9 @@ export interface LaunchNavigatorOptions {
* If true, and input location type(s) doesn't match those required by the app, use geocoding to obtain the address/coords as required. Defaults to true.
*/
enableGeocoding?: boolean;
-}
+ }
-export interface LaunchNavigator {
+ const LaunchNavigator: {
/**
* Supported platforms
@@ -69,7 +72,7 @@ export interface LaunchNavigator {
/**
* string constants, used to identify apps in native code
*/
- APP: any;
+ APP: Record<APP_KEYS, string>;
/**
* All possible transport modes
@@ -97,7 +100,7 @@ export interface LaunchNavigator {
navigate: (
destination: string | number[],
options?: LaunchNavigatorOptions
- ) => Promise;
+ ) => Promise<void>;
logEvent: (name: string, params?: any, valueToSum?: number) => void;
@@ -114,7 +117,7 @@ export interface LaunchNavigator {
* Returns a list indicating which apps are installed and available on the current device.
* @return {object} - a key/value object where the key is the app name as a constant in `LaunchNavigator.APP` and the value is a boolean indicating whether the app is available.
*/
- getAvailableApps: () => object;
+ getAvailableApps: () => Promise<Record<string, boolean>>;
/**
* Returns the display name of the specified app.
@@ -215,4 +218,7 @@ export interface LaunchNavigator {
enableDebug: (
enabled: boolean
) => void;
+ }
+
+ export default LaunchNavigator;
}
\ No newline at end of file
Hope this help.
Fix published to npm as v1.0.9 - let me know if that fixes it
The setGoogleApiKey
method is still missing from types 😕
quick fix related to the subject : https://github.com/dpa99c/react-native-launch-navigator/pull/40
Bug report
Current behavior:
It seems the types are not recognised with this version.
There also seems to be a typing error in index.d.ts
Environment information React Native: "0.66.2", Typescript Version 4.2.4