Created
March 1, 2021 12:05
-
-
Save raulh82vlc/f94bdc61694d6618e386752e8b3b805d to your computer and use it in GitHub Desktop.
SearchUIStateHandler uses collectAsState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ActivityScope | |
class SearchUIStateHandler @Inject constructor() { | |
private var composeView: ComposeView? = null | |
private lateinit var stateFlow: StateFlow<TweetsUIState> | |
fun initStateFlowAndViews(stateFlowUI: StateFlow<TweetsUIState>) { | |
stateFlow = stateFlowUI | |
composeView?.setContent { | |
TweetsWithSearchTheme { | |
StatesUI() | |
} | |
} | |
@Composable | |
fun StatesUI() { | |
val state: State<TweetsUIState> = stateFlow.collectAsState() | |
StateUIValue(state.value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment