BILDIT-Platform / react-native-bildit-flybuy

React Native FlyBuy module. Supports Core, Pickup, Notify, and Presence Native SDK APIs.
9 stars 6 forks source link

Type Error #36

Closed mohanenm closed 2 years ago

mohanenm commented 2 years ago

Getting this error:

TypeError: _reactNativeBilditFlybuy.default.Pickup.onPermissionChanged is not a function. (In '_reactNativeBilditFlybuy.default.Pickup.onPermissionChanged()', '_reactNativeBilditFlybuy.default.Pickup.onPermissionChanged' is undefined)

zeabdelkhalek commented 2 years ago

@mohanenm Is this in Android or iOS? I think the function is available only on Android

mohanenm commented 2 years ago

We were seeing the error on android. I was not able to recreate it.

mohanenm commented 2 years ago

The issue comes up sporadically and on the first launch of the application, it is not widespread. Could there be something to permissions not being set yet?

zeabdelkhalek commented 2 years ago

@mohanenm How I can reproduce this issue?

ArunkvG commented 2 years ago

Below is the code snippet. where the function is called const res = await check( Platform.OS == 'ios' ? PERMISSIONS.IOS.LOCATION_WHEN_IN_USE : PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION, ); let hasPermission = false; if (res == RESULTS.GRANTED) { hasPermission = true;

    FlyBuy.Pickup.onPermissionChanged();

} else if (res === RESULTS.DENIED) {
  const res2 = await request(
    Platform.OS == 'ios'
      ? PERMISSIONS.IOS.LOCATION_WHEN_IN_USE
      : PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION,
  );
  hasPermission = res2 === RESULTS.GRANTED;
}

Before calling the above function in home screen flybuy is initialized using below snippet in app.tsx. So app.tsx loads 1st then home screen will load

useAsyncEffect(async () => {
const iosToken = await RemoteConfig.getRemoteValue('flybuy_token_ios')
const androidToken = await RemoteConfig.getRemoteValue('flybuy_token_android')
await notifee.createChannel({
  id: 'default',
  name: 'TSC Notifications',
  lights: false,
  vibration: true,
  importance: AndroidImportance.DEFAULT,
});
if (Platform.OS === 'ios') {
  FlyBuy.Core.configure(iosToken);
} else {
 FlyBuy.Core.configure(androidToken);
}
FlyBuy.Pickup.configure();

}, []);

addingama commented 2 years ago

@mohanenm @ArunkvG Sorry I can't reproduce the issue.

Can you create a sample repo to reproduce the issue?

mohanenm commented 2 years ago

I was not able to reproduce