Code Monkey home page Code Monkey logo

Comments (15)

uvaysss avatar uvaysss commented on June 23, 2024

Also I tried updating to the last recommendation with onBackPressedDispatcher, but nothing has changed, looks like the animation is to long (weird, I know), but looks like a race condition of animation.

from simple-stack.

Zhuinden avatar Zhuinden commented on June 23, 2024

Hello, unfortunately I can't really do much without a minimal sample that reproduces this. TRANSIT_FRAGMENT_FADE is built into fragments, and shouldn't cause freezes at all.

If you overrode onForwardNavigation, onBackwardNavigation, onReplaceNavigation, make sure you don't call super.onForwardNavigation and so on.

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

Could you, please, just set this animation to any of your project to reproduce it?
I will later prepare some sample project for this use case.

from simple-stack.

Zhuinden avatar Zhuinden commented on June 23, 2024

I have been using this animation and did not encounter this issue.

from simple-stack.

Zhuinden avatar Zhuinden commented on June 23, 2024

Actually, now that I recall, the one time I did have some lag was when my fragmentKey.toString() took non-negligible time.

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

Sorry for the delay.

I think I found the pattern, it looks like it happens when I navigate back from a "heavy" screen, in my case it's a screen with webview. And it doesn't happen consistent, sometimes the navigation works fine.

I have an open source project where you can reproduce the bug - https://github.com/Jawziyya/azkar-android/tree/feature/hadith.

Sorry, but the app is only in russian language, but you will find a Settings menu on the main screen, it will open a webview from where you can than than navigate back with close button. Here is the settings screen - https://github.com/Jawziyya/azkar-android/tree/feature/hadith/app/src/main/java/io/jawziyya/azkar/ui/settings.

Also I have noticed it happens only when I navigate back through calling requireActivity().onBackPressed(), when I go back by the system navigation it's fine, weird.

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

Also I've notice now, that it look more like app crash, but I don't see any logs about it, maybe there is some system crash.

EDIT.
found in the logs

Exception thrown during dispatchAppVisibility Window{a79cf22 u0 io.jawziyya.azkar/io.jawziyya.azkar.ui.AppActivity EXITING} android.os.DeadObjectException

from simple-stack.

Zhuinden avatar Zhuinden commented on June 23, 2024

Your coroutine scope should be protected val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)

And you are not setting the disposition strategy on the Fragment's ComposeView setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)

Maybe one of these is the cause

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

I have there an extensions function, that sets the strategy createComposeView

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

Also I don't see a problem not having the right dispatcher, because in this case I'm not calling it.

from simple-stack.

Zhuinden avatar Zhuinden commented on June 23, 2024

I enabled hardware acceleration on your WebView.

            webView.clipToOutline = true
            webView.setLayerType(View.LAYER_TYPE_HARDWARE, null) // <----
            webView.layoutParams = ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT
            )

By adding `webView.setLayerType(View.LAYER_TYPE_HARDWARE, null) it works.

I don't know why it happened, but it is not caused by Simple-Stack. Anyway, if you add that line, it will stop crashing.

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

This is not definitely a simple stack issue.

The funny thing is, that I noticed it also happens when I call requireActivity()::onBackPressed from the material component IconButton onclick, if I use an another custom button with clickable modifier it works fine.. Also I checked if it's called maybe twice, but no, the log show only 1 call of the method..

from simple-stack.

Zhuinden avatar Zhuinden commented on June 23, 2024

This is not definitely a simple stack issue.

The funny thing is, that I noticed it also happens when I call requireActivity()::onBackPressed from the material component IconButton onclick, if I use an another custom button with clickable modifier it works fine.. Also I checked if it's called maybe twice, but no, the log show only 1 call of the method..

well as I mentioned, if you add hardware acceleration to the WebView, it stops crashing

I found that this also happened in React Native projects for some reason. One of the fixes said "set 0.99 alpha" which is just funny.

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

That's so weird.

Anyway, thank you for help and quick response!

from simple-stack.

uvaysss avatar uvaysss commented on June 23, 2024

I found that by removing webView.clipToOutline = true fixes the issue too. I think that's very weird that this things are somehow connected, but still they should kept in mind.

I've just recently added this clip function call, because of https://issuetracker.google.com/issues/242463987.

I don't know which solution would be best, but I will probably choose not to use the material component and just add some custom AppBar to solve this bug.

from simple-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.