android / android/nowinandroid
[Documentation]: Improve about event
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Page URL (type "NEW" for a new page suggestion)
NEW
### What's the documentation problem or suggestion?
I hate to pass event up to parent node. Especially the child nodes are deep.
I create CompositionLocal object like:
`data class CallbackManager(`
` val onNavigateToWebView: (url: String) -> Unit = {}`
` )`
` val LocalCallbackManager = staticCompositionLocalOf { CallbackManager() }`
Provides it as top as in my application like:
`CompositionLocalProvider(LocalCallbackManager provides`
` CallbackManager(`
` onNavigateToWebView = {url ->`
` appState.navController.navigateToWebView(url)`
` }`
` )`
` ) {`
` ......`
` }`
In my child node
`val callbackManager = LocalCallbackManager.current`
`callbackManager . onNavigateToWebView ()`
I think this is better to pass the callback up to the parent node when the child is too deep~
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
The issue does not name a documentation page, source file, or test. Start by locating the project's existing documentation and Kotlin event-handling examples, then determine whether this CompositionLocal suggestion has an agreed documentation scope; done requires a decided recommendation and a clearly identified page or example to update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100