Skip to content

TextInput should have intrinsic size based on placeholder #12904

Closed
@bryanjclark

Description

@bryanjclark

Description

I'm trying to make a UISearchField using RN components, and I'm unable to create a center-aligned text-and-icon layout for the placeholder ("empty state") of the text field.

I've added some borders and background colors to highlight what's going on - notice how the light-blue area (where the TextInput is) is collapsed to near-zero width:
pasted image at 2017_03_13 10_20 am

However, if I replace the TextInput with a Text component, the layout works as expected with flexGrow and flexShrink:
simulator screen shot mar 13 2017 10 36 05 am

Reproduction

I've created a sample project here that demonstrates the issue: https://sketch.expo.io/Sk5b_uEox

Solution

Adjust TextInput's implementation so its value and placeholder work with flexGrow and flexShrink.

Additional Information

  • React Native version: RN v43
  • Platform: iOS, haven't tried Android
  • Dev tools: iOS 10.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions