File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
example/examples/src/routes/TextArea
packages/core/src/TextArea Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,8 @@ export default class TextAreaView extends Component<TextAreaProps> {
6767 </ Card >
6868 < Card title = "自定义输入框样式" style = { styles . card } >
6969 < TextArea
70+ height = { 150 }
7071 style = { {
71- height : 150 ,
7272 borderColor : 'blue' ,
7373 borderWidth : 2 ,
7474 } }
Original file line number Diff line number Diff line change @@ -154,8 +154,8 @@ function Demo() {
154154 onChange= {(value ) => {
155155 setValue (value);
156156 }}
157+ height= {150 }
157158 style= {{
158- height: 150 ,
159159 borderColor: ' green' ,
160160 borderWidth: 2 ,
161161 }}
@@ -200,12 +200,13 @@ export default Demo
200200| 参数 | 说明 | 类型 | 默认值 |
201201| ------| ------| -----| ------|
202202| ` textAlignVertical ` | 文本位置 | "top" \| "center" \| "auto" \| "bottom" | ` top ` |
203- | ` placeholder ` | 默认提示语 | String | |
203+ | ` placeholder ` | 默认提示语 | String | - |
204204| ` placeholderTextColor ` | 提示语颜色 | ` string ` | ` #989FB2 ` |
205205| ` maxLength ` | 最大字符数 | ` number ` | ` 100 ` |
206206| ` numberOfLines ` | 输入框的行数(Android) | ` number ` | ` 30 ` |
207207| ` editable ` | 是否禁用 | ` boolean ` | ` true ` |
208- | ` onChange ` | 文本域内容变化时触发 | ` (val: string) => void ` | |
209- | ` value ` | 文本框中的文字内容 | ` string ` | |
208+ | ` onChange ` | 文本域内容变化时触发 | ` (val: string) => void ` | - |
209+ | ` value ` | 文本框中的文字内容 | ` string ` | - |
210210| ` showWords ` | 是否展示字数 | ` boolean ` | ` false ` |
211- | ` fontStyle ` | 输入框文字样式 | ` StyleProp<TextStyle> ` | |
211+ | ` fontStyle ` | 输入框文字样式 | ` StyleProp<TextStyle> ` | - |
212+ | ` height ` | 输入框高度 | ` number ` | 0 |
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export interface TextAreaProps extends ViewProps {
4242 fontStyle ?: StyleProp < TextStyle > ;
4343 /** 自适应内容高度 */
4444 autoSize ?: boolean ;
45+ height ?: number ;
4546}
4647
4748function TextArea ( props : TextAreaProps ) {
@@ -58,11 +59,12 @@ function TextArea(props: TextAreaProps) {
5859 autoSize = false ,
5960 style,
6061 fontStyle,
62+ height : defaultHeight = 0 ,
6163 ...other
6264 } = props ;
6365
6466 const [ defaultText , setDefaultText ] = useState < string > ( '' ) ;
65- const [ height = 0 , setHeight ] = useState < number > ( 0 ) ;
67+ const [ height = 0 , setHeight ] = useState < number > ( defaultHeight ) ;
6668
6769 const onChangeValue = ( event : NativeSyntheticEvent < TextInputChangeEventData > ) => {
6870 if ( autoSize ) {
You can’t perform that action at this time.
0 commit comments