urbanairship / react-native-airship

Airship React Native module
Other
88 stars 62 forks source link

`featureFlagManager.flag` throwing error on Android. #540

Closed idrakimuhamad closed 11 months ago

idrakimuhamad commented 11 months ago

I'm trying to do some exploration on Feature Flag using the RN SDK. Our account has been enabled for this.

The API are working on iOS. However, on Android its throwing error.

Airship.featureFlagManager.flag(flag).then((feature) => {
      console.log(`feature-flag: ${flag}`, feature)
      return feature
})

// TypeError: undefined is not a function

This is thrown at .flag as it appears this.module.featureFlagManagerFlag inside the AirshipFeatureFlagManager seems to be undefined. I looked at the source, it seems to be there.

SDK version 17.1.0

idrakimuhamad commented 11 months ago

Further checking on the source code, it appear that the native method are not annotated with @ReactMethod. Both featureFlagManagerFlag and featureFlagManagerTrackInteraction miss this out. Adding this solve the issue.

rlepinski commented 11 months ago

@idrakimuhamad Thanks for the report, will try to get it resolved today

idrakimuhamad commented 11 months ago

I've actually created a PR here

https://github.com/urbanairship/react-native-airship/pull/542