Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cndocs/textinput.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ TextInput 是一个允许用户在应用中通过键盘输入文本的基础组
最简单的用法就是放一个 `TextInput` 在界面上,然后订阅它的 `onChangeText` 事件来读取用户的输入。通常做法是在 `onChangeText` 中用 `setState`(或 `useState`)把用户的输入写入 state,然后在需要的地方从 state 中取值。它还有一些其它的事件,例如 `onSubmitEditing` 和 `onFocus`。一个简单的例子如下:

```SnackPlayer name=TextInput%20Example
import {useState} from 'react';
import {StyleSheet, TextInput} from 'react-native';
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';

const TextInputExample = () => {
const [text, onChangeText] = React.useState('Useless Text');
const [number, onChangeNumber] = React.useState('');
const [text, onChangeText] = useState('Useless Text');
const [number, onChangeNumber] = useState('');

return (
<SafeAreaProvider>
Expand Down Expand Up @@ -49,14 +50,15 @@ export default TextInputExample;

原生元素还暴露了两个方法:`.focus()` 和 `.blur()`,可以让你在代码中主动让 TextInput 获取或失去焦点。

注意有些属性仅在 `multiline` 为 `true/false` 时才有效。此外,当 `multiline=true` 时,为元素的某一个边添加边框样式(例如:`borderBottomColor`、`borderLeftWidth` 等)将不会生效。为了实现同样的效果,你可以使用一个 `View` 来包裹 `TextInput`
注意有些属性仅在 `multiline` 为 `true/false` 时才有效:

```SnackPlayer name=Multiline%20TextInput%20Example
import {useState} from 'react';
import {TextInput, StyleSheet} from 'react-native';
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';

const MultilineTextInputExample = () => {
const [value, onChangeText] = React.useState('Useless Multiline Placeholder');
const [value, onChangeText] = useState('Useless Multiline Placeholder');

// 你可以试着输入一种颜色,比如red,那么这个red就会作用到View的背景色样式上
return (
Expand Down
14 changes: 7 additions & 7 deletions cnwebsite/src/components/releases/_releases-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
| -------- | --------------- | ------------ | ------------ | --------------------------------------------- |
| `0.89.x` | 2026-11-03 | 2026-12-07 | Future | |
| `0.88.x` | 2026-09-07 | 2026-10-12 | Future | |
| `0.87.x` | 2026-07-06 | 2026-08-10 | Future | |
| `0.86.x` | 2026-05-04 | 2026-06-08 | Future | |
| `0.85.x` | 2026-03-02 | 2026-04-06 | Future | |
| `0.84.x` | 2026-01-05 | 2026-02-09 | Future | |
| `0.83.x` | 2025-11-03 | 2025-12-10 | Active | [Details](/blog/2025/12/10/react-native-0.83) |
| `0.82.x` | 2025-09-01 | 2025-10-06 | Active | [Details](/blog/2025/10/08/react-native-0.82) |
| `0.81.x` | 2025-07-10 | 2025-08-12 | End of Cycle | [Details](/blog/2025/08/12/react-native-0.81) |
| `0.87.x` | 2026-07-06 | 2026-08-10 | Active | |
| `0.86.x` | 2026-05-04 | 2026-06-09 | Active | |
| `0.85.x` | 2026-03-02 | 2026-04-06 | End of Cycle | |
| `0.84.x` | 2026-01-05 | 2026-02-09 | Unsupported | |
| `0.83.x` | 2025-11-03 | 2025-12-10 | Unsupported | [Details](/blog/2025/12/10/react-native-0.83) |
| `0.82.x` | 2025-09-01 | 2025-10-06 | Unsupported | [Details](/blog/2025/10/08/react-native-0.82) |
| `0.81.x` | 2025-07-10 | 2025-08-12 | Unsupported | [Details](/blog/2025/08/12/react-native-0.81) |
| `0.80.x` | 2025-05-07 | 2025-06-12 | Unsupported | [Details](/blog/2025/06/12/react-native-0.80) |
| `0.79.x` | 2025-03-04 | 2025-04-08 | Unsupported | [Details](/blog/2025/04/08/react-native-0.79) |
| `0.78.x` | 2025-01-15 | 2025-02-19 | Unsupported | [Details](/blog/2025/02/19/react-native-0.78) |
Expand Down