onValueChange tells us when the user interacts with the picker, and provides the column and value of the event.
However, when we edit the options prop after the initial render, we do not know what is shown as selected to the user.
Solution:
Pass the selections out as a parameter when onValueChange is called as an additional argument.
Notes
Ive left this as a draft at the moment, as the unit test for this is difficult to make consistent due to race conditions (Hence the expect.any(String)), and I am yet to test the changes on a real device.
Problem:
onValueChange
tells us when the user interacts with the picker, and provides the column and value of the event. However, when we edit theoptions
prop after the initial render, we do not know what is shown as selected to the user.Solution:
Pass the selections out as a parameter when
onValueChange
is called as an additional argument.Notes
Ive left this as a draft at the moment, as the unit test for this is difficult to make consistent due to race conditions (Hence the
expect.any(String)
), and I am yet to test the changes on a real device.