onseok / peekaboo

🌄 Kotlin Multiplatform library for Compose Multiplatform, designed for seamless integration of an image picker feature in iOS and Android applications.
Apache License 2.0
241 stars 20 forks source link

Fix PeekabooCameraState recreation when lambda onCapture does not memoized #75

Closed SuLG-ik closed 7 months ago

SuLG-ik commented 7 months ago

When during recomposition onCapture lambda is recreating, PeekabooCameraState is recreating too. There is bug with state's isCapturing, isCameraReady, cameraMode is set to default values after creating new PeekabooCameraState. Now onCapture does not affect state recreating, it sets as new onCapture callback in PeekabooCameraState.

P.S. fix in 0.5.0 - remember onCapture lambda.

onseok commented 7 months ago

LGTM 👍