Android:滚动视图,其中包含textInput不滚动

Mey*_*ehr 5 android textinput scrollview react-native

我有一个scrollView包含太多的textInput。一切正常,直到我添加textAlign: 'right'到TextInput样式。之后,ScrollView无法响应滚动。这个问题只是在android中发生的,在iOS中按预期工作。我在Snake.expo中添加了一个简单的代码

  render() {
    let TextInput2 = (
      <TextInput
        style={{
          flex: 1,
          textAlign: 'right',
          height: 50
        }}
        placeholder="placeholder"
      />
    );
    return (
      <ScrollView>
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
      </ScrollView>
    );
  }
Run Code Online (Sandbox Code Playgroud)

mil*_*rac 1

如果 a 中有太多项目,ScrollView那么也许您应该考虑使用ListView. 我也有类似的问题。在 Android 中,当太多项目需要滚动后,有时ScrollView会首先开始失败。我认为 i-devices 在渲染 React Native 组件方面有更好的优化,这可以防止它们过早失败。