fix: 🐛 broken android studio preview#129
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR addresses Android Studio Compose Preview failures for DotLottieAnimation and DotLottieGLAnimation by short-circuiting native rendering paths when running in inspection (preview) mode, allowing the preview to render the surrounding layout instead of breaking.
Changes:
- Detects Compose preview via
LocalInspectionMode.currentand skips DotLottie rendering work. - Renders a minimal placeholder
Boxwith a default minimum size during preview to keep the component visible.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dotlottie/src/main/java/com/lottiefiles/dotlottie/core/compose/ui/DotLottieGLAnimation.kt | Adds an inspection-mode early return with a placeholder Box to avoid preview-time GL/AndroidView rendering. |
| dotlottie/src/main/java/com/lottiefiles/dotlottie/core/compose/ui/DotLottieAnimation.kt | Adds an inspection-mode early return with a placeholder Box to avoid preview-time player/JNI initialization and rendering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #39