Closed ChromeQ closed 4 months ago
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch react-native-radar@3.12.1 for the project I'm working on.
react-native-radar@3.12.1
The type for Radar.isTracking() is incorrect, it returns a promise of a boolean but the types say it will be a straight up boolean.
Radar.isTracking()
Here are some links to the native code which all looks a bit promisey: Android: https://github.com/radarlabs/react-native-radar/blob/efb1502d48ff10175852585af273b79b6a3fbda0/android/src/main/java/io/radar/react/RNRadarModule.java#L529 iOS: https://github.com/radarlabs/react-native-radar/blob/efb1502d48ff10175852585af273b79b6a3fbda0/ios/RNRadar.m#L475
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-radar/dist/src/@types/RadarNativeInterface.d.ts b/node_modules/react-native-radar/dist/src/@types/RadarNativeInterface.d.ts index 4d22a8b..f228f2f 100644 --- a/node_modules/react-native-radar/dist/src/@types/RadarNativeInterface.d.ts +++ b/node_modules/react-native-radar/dist/src/@types/RadarNativeInterface.d.ts @@ -24,7 +24,7 @@ export interface RadarNativeInterface { stopTracking: () => void; getTrackingOptions: () => Promise<RadarTrackingOptions>; isUsingRemoteTrackingOptions: () => Promise<boolean>; - isTracking: () => boolean; + isTracking: () => Promise<boolean>; setForegroundServiceOptions: (options: RadarTrackingOptionsForegroundService) => void; setNotificationOptions: (options: RadarNotificationOptions) => void; getTripOptions: () => Promise<RadarTripOptions>; diff --git a/node_modules/react-native-radar/src/@types/RadarNativeInterface.ts b/node_modules/react-native-radar/src/@types/RadarNativeInterface.ts index 75d16a8..9e31334 100644 --- a/node_modules/react-native-radar/src/@types/RadarNativeInterface.ts +++ b/node_modules/react-native-radar/src/@types/RadarNativeInterface.ts @@ -68,7 +68,7 @@ export interface RadarNativeInterface { stopTracking: () => void; getTrackingOptions: () => Promise<RadarTrackingOptions>; isUsingRemoteTrackingOptions: () => Promise<boolean>; - isTracking: () => boolean; + isTracking: () => Promise<boolean>; setForegroundServiceOptions: ( options: RadarTrackingOptionsForegroundService ) => void; diff --git a/node_modules/react-native-radar/src/index.native.ts b/node_modules/react-native-radar/src/index.native.ts index b624d40..17aad85 100644 --- a/node_modules/react-native-radar/src/index.native.ts +++ b/node_modules/react-native-radar/src/index.native.ts @@ -140,7 +140,7 @@ const getTrackingOptions = (): Promise<RadarTrackingOptions> => const isUsingRemoteTrackingOptions = (): Promise<boolean> => NativeModules.RNRadar.isUsingRemoteTrackingOptions(); -const isTracking = (): boolean => NativeModules.RNRadar.isTracking(); +const isTracking = (): Promise<boolean> => NativeModules.RNRadar.isTracking(); const setForegroundServiceOptions = ( options: RadarTrackingOptionsForegroundService
This issue body was partially generated by patch-package.
Hi @ChromeQ, thanks for raising the issue, you are correct that isTracking() should return a promise, I've put up a PR to address this.
isTracking()
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
react-native-radar@3.12.1
for the project I'm working on.The type for
Radar.isTracking()
is incorrect, it returns a promise of a boolean but the types say it will be a straight up boolean.Here are some links to the native code which all looks a bit promisey: Android: https://github.com/radarlabs/react-native-radar/blob/efb1502d48ff10175852585af273b79b6a3fbda0/android/src/main/java/io/radar/react/RNRadarModule.java#L529 iOS: https://github.com/radarlabs/react-native-radar/blob/efb1502d48ff10175852585af273b79b6a3fbda0/ios/RNRadar.m#L475
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.