tv-samples icon indicating copy to clipboard operation
tv-samples copied to clipboard

JetStream crashes on home screem : Focus restoration on navigation popBackStack and focus restoration using state Modifiers

Open ChetanPatelPlayBoxTV opened this issue 7 months ago • 2 comments

In the JetStream tv app sample, it has a createInitialFocusRestorerModifiers() function which acts as the focus restorers of a TvLazyRow/Column for its children.

When I tried to scroll to the end item of the list - making the first item hidden from the current view - and tried to go to my second screen and immediately pop back from it, the app constantly throws:

` java.lang.IllegalStateException: FocusRequester is not initialized. Here are some possible fixes:

  1. Remember the FocusRequester: val focusRequester = remember { FocusRequester() }
  2. Did you forget to add a Modifier.focusRequester() ?
  3. Are you attempting to request focus during composition? Focus requests should be made in response to some event. Eg Modifier.clickable { focusRequester.requestFocus() } at androidx.compose.ui.focus.FocusRequester.focus$ui_release(FocusRequester.kt:259) at androidx.compose.ui.focus.FocusTransactionsKt.performCustomEnter-Mxy_nc0(FocusTransactions.kt:293) at androidx.compose.ui.focus.FocusTransactionsKt.performCustomRequestFocus-Mxy_nc0(FocusTransactions.kt:271)`

ChetanPatelPlayBoxTV avatar Jan 12 '24 12:01 ChetanPatelPlayBoxTV