Replies: 1 comment 1 reply
-
You have to send it in the same event object: actor.send({ type: "submit", value: phoneNumber }) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We use xstate for our user onboarding flow in our react native app, the code is shorten as below:
From ENTER_PHONE_NUMBER_SCREEN, when we hit
actor.send({type: "submit"}, {value: {phoneNumber})
, it triggers the transition fromenterPhoneNumber
tophoneVerification
, and on entry it navigates users to PHONE_VERIFICATION_SCREEN. This works as expected.However, in PHONE_VERIFICATION_SCREEN, when we try to get context from
actor.getSnapShot
,phoneNumber
is not always populated. For some users it has the phoneNumber that's assigned to the context, for some users it doesn't.We also tried to add a guard for the transition like:
but it doesn't work either.
If we add a slight delay on the navigation like this
it works without any problem.
My questions are:
guard
is the previous context, if that's the case, how can we make sure it only transit based on the latest context?actor.getSnapShot
doesn't seem to have the latest context after transition happens either, what's the correct way to get latest context if we ever want to use that in the component?Beta Was this translation helpful? Give feedback.
All reactions