Closed erawhctim closed 5 years ago
Your expectations seem correct to me. So to clarify, the state itself is actually being restored via the bundle, but the callback for the tabIndex isn't being called, correct?
Exactly. The code looks like it triggers the FragNavTabHistoryController
, but I was expecting it to also call my custom TransactionListener
to notify of the restored tab
Yeah, I think it makes sense to call the TransactionListener as well, should be an easy fix.
@ncapdevi Great! If you want, I can try and get a PR up for you for that fix today or tomorrow.
Yeah that would be great!
Fixed in 3.2.0 #204
(version 3.1.0)
Calling
FragNavController.onSaveInstanceState
doesn't work as expected andinitialize
doesn't restore the previously selected tab.The code is running, it just seems like it wasn't designed as I expected the "tab restore" flow to work.
I'm testing this via the "Don't keep activities" developer setting on the device. If I selected tab 3 of 5 (default is 1), then launch another activity and then press back, the first activity's state is saved via
onSaveInstanceState
, then it is restored inonCreate
and the saved state is passed intoFragNavController.initialize
- all of this is working.However,
FragNavController.restoreFromBundle
doesn't pre-select the previous tab that was saved. The privaterestoreFromBundle
restoresfragmentStacksTags
and thecurrentStackIndex
value properly, but I would expect it to also select the tab index and notify theTransactionListener
so I can update my UI according to the pre-selected previous tab that was reloaded from the saved state.Is this expected behavior? I'm using a fork and have updated this so its not an issue at the moment, but it seems like a miss.