Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlendState is coming in as UnknownState on iOS #207

Open
WooMinGy opened this issue Nov 7, 2023 · 2 comments
Open

BlendState is coming in as UnknownState on iOS #207

WooMinGy opened this issue Nov 7, 2023 · 2 comments

Comments

@WooMinGy
Copy link

WooMinGy commented Nov 7, 2023

react : 18.2.0
react-native : 0.72.4
rive-react-native : 6.1.1

image

My Rive layers are set up as described above.
On Android, when I look at the stateName with console.log in onStateChanged, I see BlendState comes in fine,
but on iOS, BlendState is coming in as UnknownState. Is this a known issue?
All my Rive files that contain state are coming in with BlendState as UnknownState

image

image

@zplata
Copy link
Contributor

zplata commented Nov 20, 2023

Thanks for bringing this up! Looks like a bug in the underlying rive-ios runtime. This would probably be a breaking change there; until the underlying iOS runtime is updated to change this to BlendState, I might recommend two options in the meantime, with preference for the second:

  1. Keep a temporary check for UnkownState for now like in your screenshot and handle it like you would if it came in as BlendState.
  2. Are you familiar with Rive Events? It's a new feature introduced in the past few months whereby you can report a homemade "Rive Event" (created in the Rive File) with whatever metadata you need (string, numerical, boolean data). The Event can be reported in different ways, such as on a state transition, as a key in a timeline animation, or at the start/end of a state animation playing. I think the first way on state transition might make the most sense here, where the Rive Event reports on the transition to the blend state. More on that here: https://help.rive.app/editor/events and https://help.rive.app/runtimes/rive-events. This may be a cleaner solution for you than checking state names in onStateChange.

@WooMinGy
Copy link
Author

WooMinGy commented Dec 4, 2023

@zplata
Thank you for recommending the approach using Rive Events.
For now, I have implemented the first method as a temporary solution, but I plan to consider the second method when updating the Rive-related code in my app next time.
Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants