Comments (12)
Thanks, what device and API level is being used for the repro?
from accompanist.
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.
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.
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.
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.
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.
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.
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.
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.
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.
I've already left the update above. There's nothing to fix as I can't reproduce it.
from accompanist.
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)
- [Navigation Material] HOT 1
- [BottomSheetNavigator] NullPointerException (race-condition?) when using back button HOT 6
- [WebView] Doesn't save state when recycled in a LazyColumn HOT 2
- [WebView] Question about backwards writes HOT 5
- Vector animation is broken with newer libraries HOT 5
- False positive deprecation message on pagerTabIndicatorOffset variant HOT 2
- onPermissionsResult isn't triggered on POST_NOTIFICATIONS permission request (API 33). HOT 2
- [Test Harness] Deprecate with replacement of `DeviceConfigurationOverride`
- Incorrect deprecation of pagerTabIndicatorOffset HOT 2
- [Permissions] Gradle update crashing permission request and the app HOT 8
- Crash when using ProgressIndicator with `accompanist-permissions` 0.34.0 HOT 1
- [Navigation Material] Crash in BottomSheetNavigator when user goes back HOT 3
- [Navigation Material] Status bar not scrimmed when bottom sheet is shown HOT 1
- [LazyColumn] scroll observation scope does not exist HOT 3
- [Feature request] LazyTable with nested scrolling support HOT 1
- [Navigation Material] Edge to edge jumping bug when migrating from 1.1.2 to 1.2.0. HOT 1
- [Navigation Material] BackHandler is not triggered after Activity stop+start HOT 1
- [Navigation Material] DisposableEffect onDispose is not called at the right time for bottom sheet HOT 1
- [Navigation Material] Add deprecated to main README
- [Adaptive]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from accompanist.