react-native-floating-label-input
react-native-floating-label-input copied to clipboard
can't set topFocused when using staticLabel={true}
in the docs for staticLabel it says:
"For changing the position of the label with this prop as true, use the customLabelStyles topFocused and leftFocused to adjust the wanted position"
but the implementation is like this:
{staticLabel && (
<AnimatedText
onPress={setFocus}
style={[
style,
{
left: labelStyles?.left
? labelStyles?.left
: customLabelStyles.leftFocused
? customLabelStyles.leftFocused
: 20,
top: -(style?.fontSize ? style?.fontSize : 10) / 2,
},
]}
>
{label}
</AnimatedText>
)}
so setting topFocused doesn't have any effect when using staticLabel={true}
Hi @louisholley, yes you are right, but I don't think staticLabel should be used along with topFocused.. I will move the order for the left and top styles to have lower priority than labelStyles like:
{staticLabel && (
<AnimatedText
onPress={setFocus}
style={[
{
left: labelStyles?.left
? labelStyles?.left
: customLabelStyles.leftFocused
? customLabelStyles.leftFocused
: 20,
top: -(style?.fontSize ? style?.fontSize : 10) / 2,
},
style
]}
>
{label}
</AnimatedText>
)}
//...
So then the right usage scenario would be something like:
<FloatingLabelInput
// ...
labelStyles={{ top: 15, left: 20}}
/>
@Cnilton sounds ideal man, let me know when you've made the change! thanks a lot