rememberCameraPositionState() should accept `inputs` parameter
See original GitHub issueI noticed that in version 2.7.0 of maps-compose
the function rememberCameraPositionState does not accept an inputs
parameter although it just delegates to rememberSaveable
, which has vararg inputs: Any?
. Is this a deliberate design decision?
I have a situation where the value actually should be recreated because latitude and longitude change after the user has selected a different location.
I’m happy to provide a pull request if this is a desired change.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Compose and other libraries - Android Developers
Any subclass of ActivityResultContract can be used as the first argument to rememberLauncherForActivityResult() . This means that you can use this technique ...
Read more >Demo of crash when using HorizontalPager's scrollToPage ...
Configuring the map can be done by passing a MapProperties object into the GoogleMap composable, or for UI-related configurations, use ...
Read more >Integrate Google Maps into the Jetpack Compose app
By just calling GoogleMap() we are going to show a map in our app. ... We can pass many parameters to this composable,...
Read more >Jetpack Compose pass parameter to viewModel
you need to create a factory to pass dynamic parameter to ViewModel like this: class MyViewModelFactory(private val dbname: String) ...
Read more >Composable Functions - Medium
You need to pass any and all information as parameters when you call it. ... When this value changes, Compose will automatically re-execute...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Adding
inputs
torememberMarkerState
will not recreate the Marker so in theory you can exposeinputs
to bothremember
functions. But, recreatingCameraPositionState
needs to set the associatedGoogleMap
andMarkerState
needs to set the correct internalMarker
. These side effects make implementing this feature not so straightforward actually… I suggest holding off on the pull request for that reason.Good point. In case of
rememberCameraPositionState()
I tried to work around it by usingwhich works as expected but applying the same pattern to
rememberMarkerState()
did not work. The inner workings ofMarker
probably don’t take state changes into account at the moment.