将 SafeAreaView 与 nativebase 一起使用
using SafeAreaView with nativebase
我们需要使用带有 nativebase 的 react-native SafeAreaView 吗?或者它是用容器内置的?或者只使用没有容器的 SafeAreaView?
<SafeAreaView> <--- is it needed?
<Container>
</Container>
</SafeAreaView>
解释:
Here you can find the code of NativeBase's container and here你可以找到react-native的SafeAreaView的代码。
如您所见,NativeBase 的容器只是一个简单的 View,而 SafeAreaView 稍微复杂一些,如果我们查看文档,就会明白这一点:
The purpose of SafeAreaView is to render content within the safe area boundaries of a device. It is currently only applicable to iOS devices with iOS version 11 or later.
react-native/docs/safeareaview
回答
Or it is built in with container? Or just use SafeAreaView only
without container?
您可以同时使用它们,但不是必须的。正如我们从代码中看到的,容器组件并没有自己实现 SafeAreaView。
我们需要使用带有 nativebase 的 react-native SafeAreaView 吗?或者它是用容器内置的?或者只使用没有容器的 SafeAreaView?
<SafeAreaView> <--- is it needed?
<Container>
</Container>
</SafeAreaView>
解释:
Here you can find the code of NativeBase's container and here你可以找到react-native的SafeAreaView的代码。
如您所见,NativeBase 的容器只是一个简单的 View,而 SafeAreaView 稍微复杂一些,如果我们查看文档,就会明白这一点:
The purpose of SafeAreaView is to render content within the safe area boundaries of a device. It is currently only applicable to iOS devices with iOS version 11 or later.
react-native/docs/safeareaview
回答
Or it is built in with container? Or just use SafeAreaView only without container?
您可以同时使用它们,但不是必须的。正如我们从代码中看到的,容器组件并没有自己实现 SafeAreaView。