Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit bce8162

Browse files
committed
feat: add SafeAreaView to mocks
1 parent 8ca3115 commit bce8162

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/__tests__/render.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
2-
import { View } from 'react-native';
2+
import { SafeAreaView, View } from 'react-native';
3+
34
import { cleanup, toJSON, render } from '../';
45

56
afterEach(cleanup);
@@ -15,7 +16,9 @@ test('returns container', () => {
1516
});
1617

1718
test('renders options.wrapper around node', () => {
18-
const WrapperComponent = ({ children }) => <View testID="wrapper">{children}</View>;
19+
const WrapperComponent = ({ children }) => (
20+
<SafeAreaView testID="wrapper">{children}</SafeAreaView>
21+
);
1922

2023
const { container, getByTestId } = render(<View testID="inner" />, {
2124
wrapper: WrapperComponent,
@@ -26,13 +29,13 @@ test('renders options.wrapper around node', () => {
2629
<View
2730
testID="ntl-container"
2831
>
29-
<View
32+
<SafeAreaView
3033
testID="wrapper"
3134
>
3235
<View
3336
testID="inner"
3437
/>
35-
</View>
38+
</SafeAreaView>
3639
</View>
3740
`);
3841
});

src/lib/to-json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function toJSON(node) {
2424

2525
// Hoist children so that only "native elements" are in the output
2626
if (typeof node.type !== 'string') {
27-
return renderedChildren;
27+
return renderedChildren.length === 1 ? renderedChildren[0] : renderedChildren;
2828
}
2929

3030
// Function props get noisy in debug output, so we'll exclude them

src/preset/configure.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ configureNTL({
1919
'Modal',
2020
'Picker',
2121
'RefreshControl',
22+
'SafeAreaView',
2223
'ScrollView',
2324
'Switch',
2425
'Text',

0 commit comments

Comments
 (0)