首页 > 解决方案 > 输入问题上的换行符 - ReactNative(仅限 Android)

问题描述

当在android中按下输入按钮时,我试图将我的句子移动到一个新行中。但即使我按下回车按钮,文本也不会中断并继续作为一个单词。

例如;

这就是我需要的

你好

如何

但我最终得到这样的文字

你好吗

请注意,这在 ios 中完美运行。问题在于 android 键盘。我怎样才能解决这个问题?

我认为的一种方法是在我按下回车键时在我的文本输入中包含一个<br>或。\n按回车键时如何包含这些标签之一。

我的代码

                            addTextToQuestion(value) {
                                this.setState({headingState: value});
                            }

                            <TextInput
                                multiline={true}
                                blurOnSubmit={false}
                                autoFocus={true}
                                underlineColorAndroid='transparent'
                                allowFontScaling={false}
                                style={styles.questionText}
                                placeholderTextColor="#C0C0C0"
                                onChangeText={this.addTextToQuestion.bind(this)}
                                placeholder={"Your question goes here"}
                            />

标签: javascriptandroidreactjsreact-nativetextinput

解决方案


推荐阅读