Git Product home page Git Product logo

Comments (12)

chrisbanes avatar chrisbanes commented on March 29, 2024

Thanks, what device and API level is being used for the repro?

from accompanist.

Kshitij09 avatar Kshitij09 commented on March 29, 2024

Device: Samsung M30s
Model Number: SM-M307F/DS
API Level: 30 (Android 10)

I've also observed this behaviour on Lenovo Tablet running android Marshmallow (6.0)

from accompanist.

Kshitij09 avatar Kshitij09 commented on March 29, 2024

Interesting insight! even if I don't provide windowInsets to AmbientWindowInsets, the behaviour remains same. Seems like AmbientWindowInsets are able to provide only statusBar and navigationBar paddings or doesn't work well with only IME paddings

from accompanist.

Kshitij09 avatar Kshitij09 commented on March 29, 2024

Found something! using ViewWindowInsetsObserver to provide insets and adding navigationBarsWithImePadding() modifier to root Composable solves the issue.

Important: This also needs android:windowSoftInputMode="adjustResize" set for corresponding activity

Edit: But this applies insets everytime a keyboard is opened. Is this expected behaviour? or we should only apply window insets if that TextField is getting hidden by the Keyboard?

from accompanist.

chrisbanes avatar chrisbanes commented on March 29, 2024

I just tried your sample on the API 30 emulator and it works as expected, which makes me think this is a Samsung issue of some kind.

Important: This also needs android:windowSoftInputMode="adjustResize" set for corresponding activity

Yep, documented here

But this applies insets everytime a keyboard is opened. Is this expected behaviour? or we should only apply window insets if that TextField is getting hidden by the Keyboard?

Not sure what you mean here. If you're using navigationBarsWithImePadding() and the component is still being hidden by the IME, your layout probably needs to be tweaked to enable it to expand/collapse. Got an example?

from accompanist.

Kshitij09 avatar Kshitij09 commented on March 29, 2024

So what I meant is, navigationBarsWithImePadding() shifts the entire screen when keyboard is opened. Shouldn't it shift only so that TextField is visible? Like let buttons below TextField stay hidden just make TextField visible, or this is not how insets work? Also, do I need to use navigationBarsWithImePadding() this modifier for IME insets to work or it'll work implicity, IE shift screen whenever keyboard opens up?

from accompanist.

Kshitij09 avatar Kshitij09 commented on March 29, 2024

What do you mean by expected behaviour? insets are triggered on first run?

Edit: I doubt it's vendor specific issue. I'm observing same behaviour I've shown in the repro README on Lenovo Tablet

from accompanist.

chrisbanes avatar chrisbanes commented on March 29, 2024

What do you mean by expected behaviour? insets are triggered on first run?

I mean, the sample you provided works fine on the API 30 emulator. What do you mean by first run? First run of the app? Or the first opening of the IME after the device boots?

So what I meant is, navigationBarsWithImePadding() shifts the entire screen when keyboard is opened. Shouldn't it shift only so that TextField is visible? Like let buttons below TextField stay hidden just make TextField visible, or this is not how insets work?

What you do with the layout is up to you. navigationBarsWithImePadding() isn't magic, it literally just adds padding to match whatever is greater out of the nav bars and IME. How you structure your layout to handle that, is your decision. If you want to move just the single component (as you described), you should move that view into a root Box to have it float above the rest of the content.

Also, do I need to use navigationBarsWithImePadding() this modifier for IME insets to work or it'll work implicity, IE shift screen whenever keyboard opens up?

This is controlled by the android:windowSoftInputMode value. adjustResize tells the system to send IME changes as insets, and not by automatically panning/shifting the window (which is adjustPan).

from accompanist.

Kshitij09 avatar Kshitij09 commented on March 29, 2024

So panning/shifting will work automatically if I remove android:windowSoftInputMode="adjustResize" and use only ProvideWindowInsets { } at the root of view?

By first run, I meant first opening of IME. If you look at the Gif, the shifting/panning happens when the IME is opened for the second time and not the first time.

from accompanist.

chrisbanes avatar chrisbanes commented on March 29, 2024

By first run, I meant first opening of IME. If you look at the Gif, the shifting/panning happens when the IME is opened for the second time and not the first time.

I doubt very much that this is something we can workaround in this library tbh. Sounds like a timing issue in the system/framework.

I'm going to close this, as I can't reproduce this on any emulator or API 30 device I have.

from accompanist.

chrisbanes avatar chrisbanes commented on March 29, 2024

I've already left the update above. There's nothing to fix as I can't reproduce it.

from accompanist.

Kshitij09-ag avatar Kshitij09-ag commented on March 29, 2024

what was the behaviour you observed? I'll also try to run it on API 30 emulator but what is the expected behaviour here? panning should happen every time we focus a TextField which is getting hidden by the Keyboard?

from accompanist.

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.