React Native - 如何在 Android 上的 TextInput 中显示滚动条

问题描述 投票:0回答:2

我在 Android 上有一个文本输入,我希望它显示滚动指示器,但它永远不会显示,即使在滚动时也是如此。我见过人们在 ScrollView 上询问这个问题,但在 TextInput 上却没有问过

这里没有提到这个功能https://reactnative.dev/docs/textinput

        <TextInput
          ref={ref}
          textAlignVertical="top"
          margin={5}
          flex={1}
          minHeight={60}
          autoFocus={false}
          multiline={true}
          padding={2}
          maxLength={100}
          value={noteText}
          onChangeText={setNoteText}
          placeholder={`Input text here`}
        />
android react-native textinput
2个回答
0
投票

我认为你的意思是永久有一个可见的滚动条,你可以使用

persistentScrollbar={true}

[官方文档:][1] https://reactnative.dev/docs/scrollview#persistentscrollbar


-1
投票

您正在寻找

multiline
。将
multiline
设置为 true 时,该框将允许在框的定义大小内显示多行文本。当线条超出框的大小后,就会出现滚轮。

https://reactnative.dev/docs/textinput#multiline

© www.soinside.com 2019 - 2024. All rights reserved.