在NativeBase ui库中使用 和 之间有区别吗?

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

NativeBase表示将所有组件包装在<Container></Container>标记内。

  1. 这是否意味着要替换所有<View></View>标签?
  2. 使用全部时,功能或布局是否存在差异<Container>标签替换所有<View>标签,反之亦然?
  3. 我应该每个组件只使用一个<Container>并使用<View>该组件内部的其余容器?
reactjs react-native native-base
1个回答
0
投票

问题中的第三点是正确的。 Container组件每个屏幕仅应使用一次来包装所有子组件,有点像React.Fragment

[Container通常采用三个子组件

<Container>
   <Header> //<-always on top
      ...
   </Header>
   <Content> //<-supports scrolling
      ...
   </Content>
   <Footer> //<-always in the bottom
      ...
   </Footer>
</Container>

使用全部时,功能或布局是否存在差异标签替换所有标签,反之亦然?

[[不建议将所有View替换为Container,因为Container具有默认样式,并且其行为与使用View组件包装组件的行为不同。

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