React-Native 0.52.0
React: 16.2.0
Native-Base: 2.3.7
When using an input with a floating label, the entire label should be visible when floating.
Once the label starts floating, the top half of the label is cut off.
Something as simple as the following basic case causes it:
<Form>
<Item floatingLabel>
<Label>Test</Label>
<Input />
</Item>
<Item floatingLabel>
<Label>Test</Label>
<Input />
</Item>
...
</Form>

I am not able to test it on iOS at the moment.
It used to work a while ago but I only noticed it is broken now, not sure on which version it broke.
+1 I have the same issue, and it happened when I've upgraded react-native to 0.52.0
I'm having same issue, also after upgrading to 0.52
Same issue here :(
Is there any way to solve it without downgrading the react-native version?
Thanks :)
@carathorys you can add some padding to the top for <Label/>.
Gif

I found out that Label has hard coded value for top.
In my case I did something like this to fix it:
let top = 0;
if ( active || input.value.length > 0) {
top = 16;
}
where active is meta field from redux-form
<Label style={{top}}>{labelText}</Label>
Looks like it's an issue with Item component.
If you replace lineHeight from 30 to 50 here then it will not cut off Label.
Can somebody check why it has wrong value?
sure
@akhil-geekyants I appreciate the tip however a fix would be better. Want a PR?
@pennyandsean There is a PR for this
Fixed with 2.3.8
This is still in Native base 2.4.1
This will be very helpful instead of hard coding in each form.
Put a padding in the theme/components/Label.js file the path may be different for you
import variable from "./../variables/platform";
export default (variables = variable) => {
const labelTheme = {
".focused": {
width: 0
},
fontSize: 17,
paddingTop: 2 // This much is enough to fix
};
return labelTheme;
};
@raajnadar checked this with native-base : 2.4.1. Couldn't see this. Posting code.
Code
import React, { Component } from 'react';
import { Container, Header, Content, Form, Item, Input, Label } from 'native-base';
export default class App extends Component {
render() {
return (
<Container>
<Header />
<Content>
<Form>
<Item floatingLabel>
<Label>Username</Label>
<Input />
</Item>
<Item floatingLabel last>
<Label>Password</Label>
<Input />
</Item>
</Form>
</Content>
</Container>
);
}
}
Video
@raajnadar Probably you dd'nt eject theme after updating NativeBase version
@SupriyaKalghatgi will the existing changes be overwritten after ejecting??
@raajnadar
Ejecting just doing a simple copying, it's not a merging process, so yeah, you will loose your data in case if you ejected before and modified them.
@raajnadar Yes, if there is any update in native-base/src/theme, then existing changes will be overwritten on ejecting theme
This is not merge process
I also faced same issue,
Remove
lineHeight: 18
property from
@NaveenJayaram94 You mean, modifying in ejected theme and not updating NativeBase version?
@SupriyaKalghatgi
Native base theme works fine, doesn't need modification,
remove it from custom styles you have given to Lable or Item Component, if any.
@NaveenJayaram94 Yes, no need of embedding inline styles here
Most helpful comment
@carathorys you can add some padding to the top for
<Label/>.Gif