dialectlabs / blinks-react-native

MIT License
14 stars 5 forks source link

Malformed Calls from JS Leading to Exception in HostFunction #8

Closed ramyodev closed 4 weeks ago

ramyodev commented 2 months ago

Issue Summary

An error occurs when certain React components, such as KeyboardProvider or components involved in animated transitions, are used in conjunction with the Blinks SDK. This results in exceptions related to malformed calls from JavaScript, indicating potential issues with how parameters or callbacks are being handled across asynchronous operations.

Steps to Reproduce

  1. Utilize a Blink component with specified URL in a React Native project. Url: https://dial.to/?action=solana-action:https://checkmate.sendarcade.fun/api/actions/chess
  2. Integrate KeyboardProvider or navigate through screens that trigger re-renders or state updates in components like FlatList or VirtualizedList.
  3. Observe the error logs for malformed calls exceptions.

Error Message

Initially:

ERROR Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
[[60,84],[4,17],[[10437,"onKeyboardMoveInteractive",224]],22819]

After removing KeyboardProvider:

ERROR Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
[[60,84,84,84,74,74,74,74,74,74,74,74,81],[4,17,17,17,1,1,1,1,1,1,1,1,1],[[21277,"onTransitionProgress",1289],[21277,"onTransitionProgress",1290],[21277,"onTransitionProgress",1291],[1],[1],[1],[1],[1],[1],[1],[1],[3659]],31803]

Code Context

The issue arises during complex state management and component re-renders which might be triggered by animations or transitions in the UI, affecting the synchronicity of JavaScript calls to native functions.

Suggested Fixes

Environment

prsvic commented 2 months ago

Hey,

Thanks for reporting this!

I managed to reproduce something similar on my end. Just want to confirm a couple of things to make sure we're seeing the same issue:

1) Does this happen with any other action URLs? 2) Are you seeing an error like this in your logs before the Malformed Calls error? ERROR Invariant Violation: [657,"RCTView",{"aspectRatio":"<<NaN>>"}] is not usable as a native method argument

ramyodev commented 1 month ago

@prsvic Yes I saw that Invariant Violation also haven't seen it with other blinks but also haven't tested too many.

prsvic commented 1 month ago

@ramyodev Can you please update @dialectlabs/blinks-react-native to 0.2.1 and check if the issue still there?

ramyodev commented 4 weeks ago

@prsvic Can confirm, its fixed. Thank you!