Value cannot be cast from Boolean to String
Closed this issue · 5 comments
Hi,
I'm using react-native-mparticle@2.4.12
and experiencing the issue in the screenshot on Android. is_prepay
is a boolean value attribute in the event, it works fine on iOS.
My workaround for now is:
track(event) {
const payload = { ...event.payload };
// MParticleModule for Android somehow tries to cast Boolean to String which would crash the app.
if (Platform.OS === "android") {
Object.keys(payload).forEach((key) => {
if (typeof payload[key] === "boolean") {
payload[key] = String(payload[key]);
}
})
}
MParticle.logEvent(event.name, MPaticle.EventType.Other, payload);
}
Could you help me to understand the situation here? Did I miss any docs about this issue? Or is this a bug?
I have encountered the same issue when trying to log a number
in the event attributes.
UnexpectedNativeTypeException com.facebook.react.bridge.ReadableNativeMap in checkInstance
Value for numberOfImages cannot be cast from Double to String
On closer inspection of the source, it looks like only String
is supported for now:
@willpassidomo any chance this can be fixed to facilitate boolean
and number
too? Would really help with downstream analytics querying capabilities (eg. range queries on event attribute data when logging number
s).
@cheng-kang I'm so sorry this sat for so long! We were under the impression we had set up webhooks for all of our repositories, but this one seems to have slipped under the radar. I just opened a PR (referenced above) for this issue and it should be released shortly
PR was merged and this will be included in the next release!
@willpassidomo thanks for coming back. As an example we're sending through the number of images (image
) sent as attachments in a MessageSent
event, and server-side forwarding to Mixpanel, but Mixpanel seems to ingest as a string and so we can't do range queries for example: