Native Base Accordion, предупреждение VirtualizedLists - PullRequest
0 голосов
/ 26 марта 2020

Я пытаюсь работать с Accordion в Native Base, и он возвращает странное предупреждение.

Мой код:

const dataMenus = [
  { title: "Credit Card", content: "Lorem ipsum dolor sit amet" },
  { title: "Bank Account (for ACH payments)", content: "Lorem ipsum dolor sit amet" },
  { title: "Recurring Payment", content: "Lorem ipsum dolor sit amet" }
];
class MyAccount extends React.Component {
    render() {
      return (
        <Container>
          <Content padder>
            <ScrollView>
              <Accordion dataArray={dataMenus} expanded={0}/>
            </ScrollView>
          </Content>
        </Container>
      );
    }
}

Возвращается: VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.

Спасибо

1 Ответ

1 голос
/ 29 марта 2020

вы можете попробовать добавить renderContent реквизит следующим образом:

  renderSecondaryContent = ( item ) => {
    return (
      <ScrollView
        style={{
          padding: 10,
          // height: 300
        }}
        horizontal={true}
      >
        <Text>{item}</Text>
      </ScrollView>
    );
  }

  render() {
    return (
      <Container style={styles.container}>
        <Content
          // style={{ maxHeight: 200 }}
          padder
        >
          <Accordion
            dataArray={dataMenus}
            expanded={0}
            renderContent={(dataMenus) => this.renderSecondaryContent(dataMenus.content)}
          />
        </Content>
      </Container>
    );
  }

Я также добавил закуску здесь , где вы можете поэкспериментировать дальше. :)

...