Skip to content

Commit 41e198d

Browse files
sammy-SCmeta-codesync[bot]
authored andcommitted
migrate SafeAreaView from jest to Fantom (facebook#55826)
Summary: Pull Request resolved: facebook#55826 Migrate `SafeAreaView` to fantom Changelog: [Internal] Reviewed By: huntie Differential Revision: D94887194
1 parent 0b1ce70 commit 41e198d

File tree

2 files changed

+38
-36
lines changed

2 files changed

+38
-36
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.

0 commit comments

Comments
 (0)