Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/react-native-ui-lib/src/components/view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ type ReanimatedProps = Partial<Pick<RNReanimatedProps<object>, 'entering' | 'exi

export interface ViewProps extends Omit<RNViewProps, 'style'>, ReanimatedProps, ContainerModifiers, RecorderProps {
/**
* If true, will render as SafeAreaView
* If true, will render as SafeAreaView.
* On iOS this is React Native's SafeAreaView, which insets only the edges the view actually touches;
* elsewhere it is react-native-safe-area-context's SafeAreaView when that package is installed.
*/
useSafeArea?: boolean;
/**
Expand Down Expand Up @@ -108,10 +110,10 @@ function View(props: ViewProps, ref: any) {

const ViewContainer = useMemo(() => {
let container: React.ComponentType<any> = RNView;
if (useSafeArea && SafeAreaContextPackage?.SafeAreaView) {
container = SafeAreaContextPackage.SafeAreaView;
} else if (useSafeArea && Constants.isIOS) {
if (useSafeArea && Constants.isIOS) {
container = SafeAreaView;
} else if (useSafeArea && SafeAreaContextPackage?.SafeAreaView) {
container = SafeAreaContextPackage.SafeAreaView;
}

if (reanimated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ViewScreen.js",
"images": [],
"props": [
{"name": "useSafeArea", "type": "boolean", "description": "If true, will render as SafeAreaView"},
{
"name": "useSafeArea",
"type": "boolean",
"description": "If true, will render as SafeAreaView. On iOS this is React Native's SafeAreaView, which insets only the edges the view actually touches; elsewhere it is react-native-safe-area-context's SafeAreaView when that package is installed"
},
{"name": "animated", "type": "boolean", "description": "Use Animate.View as a container"},
{
"name": "reanimated",
Expand Down
Loading