NativeBase: Stacked Label Input value position is not fixed on focus
When focusing a stacked label input the position of the input text moves up some pixels. See attached screenshots.
react-native, react and native-base version
"dependencies": {
"native-base": "2.3.10",
"react": "^16.3.0-alpha.1",
"react-native": "0.54.2"
}
Expected behaviour
Text should be fixed at same position as before the focus. The original text position should be positioned aligned with the placeholder. Instead the original text position is below the placeholder with some pixels.
Actual behaviour
Unfocused input

When focusing the input the input text moves up some pixels

Steps to reproduce (code snippet or screenshot)
<Container>
<Content style={{paddingTop: 100}}>
<Item stackedLabel>
<Label>{"Stacked Label"}</Label>
<Input value={'value'} />
</Item>
</Content>
</Container>
Is the bug present in both ios and android or in any one of them?
The issue is strangely only present on ios and not android. fixedLabel has the same issue (and maybe other input label types as well)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 26 (9 by maintainers)
Commits related to this issue
- Changed searchbar input lineHeight in theme to null. Fix for issue-comment https://github.com/GeekyAnts/NativeBase/issues/1731#issuecomment-376349102 — committed to GeekyAnts/NativeBase by akhil-ga 6 years ago
- Fix for issue #1731 (Stacked Label Input value position is not fixed on focus) Fix based on issue-comment https://github.com/GeekyAnts/NativeBase/issues/1731#issuecomment-376320681 — committed to GeekyAnts/NativeBase by akhil-ga 6 years ago
- Removed lineHeight dependency of Input. Fix for issue comment https://github.com/GeekyAnts/NativeBase/issues/1731#issuecomment-384064474 based on issuecomment https://github.com/GeekyAnts/NativeBase/i... — committed to GeekyAnts/NativeBase by akhil-ga 6 years ago
@SupriyaKalghatgi It’s because you are not setting a value directly on the Input tag.
Try setting the value with a value from the state like this:
and then you will get the following result:
This bug makes me crazy As said @idrakimuhamad, @andidev workaround by setting lineHeight to null help to overcome this.
I can second this. It only happened if we assign the
valueprops to the input and the text only “jump” down whenever user starts typing which then updating thevalueprops. @andidev workaround by settinglineHeightto null help to overcome this.Dependencies:
A workaround is to set the the style of the input to
{lineHeight: null, top: 7}, e.g.