Lets take an example of AuthFlow
I have a sharedViewmodel between two screens of that flow
The two screens are PhoneNumberScreen and OTPScreen
Now on click of next in PhoneNumberScreen we validated the phone number and then navigate to the next screen which is the OTPScreen
I have UIState and UIEvent classes for all ops
if i want to navigate back from the OTPScreen i would have to trigger an event "OnNavigateBackToPhoneNumber" and then reset values like isPhoneNumberValidated = false
So that on navigating to the previous screen isPhoneNumberValidated doesnt trigger a navigation to the OTPScreen back again
Am i doing this right? Getting the imposter syndrome rn lol.
Just feels like i'm overcomplicating it. Should i not do sharedviewmodel or do the UIEvent and UIState differently
d
dorche
05/10/2024, 4:33 PM
Feels like you're contradicting yourself here - why would
isPhoneNumberValidated = true
mean "navigate to OTPScreen" if you're saying you use UiEvent for navigation?
dorche
05/10/2024, 4:36 PM
If you want to drive navigation from UiState, usually what you need is to "consume" the state (i.e. set it back to false like you've said) just before calling