Skip to content

Commit fd4fee0

Browse files
emily8rownmeta-codesync[bot]
authored andcommitted
migrate SafeAreaView from Jest to Fantom (#56310)
Summary: Pull Request resolved: #56310 Migrate `SafeAreaView` from Jest to Fantom. Note: SafeAreaView falls back to View in non-iOS environments, so `collapsable={false}` is needed to prevent Fantom from optimizing the view away. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D99290669 fbshipit-source-id: 8beaf75c4f8237e8f8955564799fed0bbf50d25a
1 parent 05ea94c commit fd4fee0

File tree

3 files changed

+38
-57
lines changed

3 files changed

+38
-57
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
*/
10+
11+
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
12+
13+
import * as Fantom from '@react-native/fantom';
14+
import * as React from 'react';
15+
import {SafeAreaView, Text} from 'react-native';
16+
17+
describe('<SafeAreaView>', () => {
18+
it('renders with children', () => {
19+
const root = Fantom.createRoot();
20+
21+
Fantom.runTask(() => {
22+
root.render(
23+
// collapsable={false} is needed to prevent the View (SafeAreaView falls
24+
// back to View in non-iOS environments) from being optimized away in
25+
// the Fantom output.
26+
<SafeAreaView collapsable={false}>
27+
<Text>Hello World!</Text>
28+
</SafeAreaView>,
29+
);
30+
});
31+
32+
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
33+
<rn-view>
34+
<rn-paragraph>Hello World!</rn-paragraph>
35+
</rn-view>,
36+
);
37+
});
38+
});

packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/react-native/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)