question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextInput label is center aligned for multiline textInputs

See original GitHub issue

Environment

react-native-paper: “3.6.0” iOS: 13.3.1

Description

Label for multiline Textareas are aligned to the center. I expected the label to be aligned to the top. I don’t see a prop to style label for Textinput either.

Screen Shot 2020-02-26 at 5 31 43 PM

Reproducible Demo

import { TextInput } from 'react-native-paper';

export default class MyComponent extends React.Component {
  state = {
    text: ''
  };

  render(){
    return (
      <TextInput
        label='Email'
        value={this.state.text}
        multiline
        onChangeText={text => this.setState({ text })}
        style={{height:400}}
      />
    );
  }
}```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
antaehyeoncommented, Feb 27, 2020

Hi.

Can you use the render props ?

below example code.


import { ..., Platform, TextInput } from "react-native";
import { TextInput as PaperTextInput } from "react-native-paper";
 ...

 // just temporarily style
  const PAPER_TEXT_INPUT_STYLE = {
    width: "100%",
    height: 160,
    borderRadius: 4
  };

  const RN_TEXT_INPUT_STYLE = {
    width: "100%",
    height: 160,
    fontSize: 14,
    padding: 16,
    ...Platform.select({
      android: {
        textAlignVertical: "top"
      }
    })
  };

  return (
    <PaperTextInput
      style={PAPER_TEXT_INPUT_STYLE}
      multiline={true}
      mode={"outlined"}
      render={props => (
        <TextInput
          {...props}
          style={RN_TEXT_INPUT_STYLE}
          placeholder={PLACE_HOLDER}
          placeholderTextColor={Colors.grey490}
        />
      )}
    />
  );

image

I hope will be applied in the textInput style attribute of the react native paper.

0reactions
isinha-onefccommented, Nov 10, 2022

This issue is still occurring. However, mode="outlined" along with multiline and numberOfLines seemed to fix this issue for me on Android.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to align text input correctly in react native?
I have found the solution that in Android, TextInput style textAlignVertical: 'top' ... Update 2015-07-03: multiline text inputs have now been merged:.
Read more >
TextInput
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
Read more >
Text Input — Kivy 2.1.0 documentation
The TextInput widget provides a box for editable plain text. Unicode, multiline, cursor navigation, selection and clipboard features are supported.
Read more >
Text input control in Power Apps
AccessibleLabel – Label for screen readers. Align – The location of text in relation to the horizontal center of its control.
Read more >
Text in Compose - Jetpack
The following samples show how multi-line text looks with various LineHeightStyle.Trim configurations when alignment is centered ( LineHeightStyle.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found