mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: TLDR even more docs changes So I created a More Resources doc that aggregates the high-quality-but-off-site stuff. Let's try to put more outlinks there. Also I removed the stuff on Support that was not support, and some misc changes to clean stuff up. Closes https://github.com/facebook/react-native/pull/8329 Differential Revision: D3471669 Pulled By: JoelMarcey fbshipit-source-id: 54edd543ced1b3a8f3d0baca5475ac96bae6e487
38 lines
1.1 KiB
Markdown
38 lines
1.1 KiB
Markdown
---
|
|
id: basics-component-textinput
|
|
title: TextInput
|
|
layout: docs
|
|
category: The Basics
|
|
permalink: docs/basics-component-textinput.html
|
|
next: basics-component-scrollview
|
|
---
|
|
|
|
Direct text-based user input is a foundation for many apps. Writing a post or comment on a page is a canonical example of this. [`TextInput`](/react-native/docs/textinput.html#content) is a basic component that allows the user to enter text.
|
|
|
|
This example creates a simple `TextInput` box with the `string` `Type something here` as the placeholder when the `TextInput` is empty.
|
|
|
|
```JavaScript
|
|
import React from 'react';
|
|
import { AppRegistry, Text, TextInput, View } from 'react-native';
|
|
|
|
const AwesomeProject = () => {
|
|
return (
|
|
<View style={{paddingTop: 22}}>
|
|
<TextInput
|
|
style={{
|
|
height: 40,
|
|
margin: 5,
|
|
paddingLeft: 10,
|
|
borderColor: 'black',
|
|
borderWidth: 1
|
|
}}
|
|
placeholder="Type something here"
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
// App registration and rendering
|
|
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
|
|
```
|