From 80f531f9f4c5eb43af6b4e7979cf6b7b3af12992 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 25 Jul 2023 12:00:58 -0700 Subject: [PATCH] Remove need for platform overrides in SafeAreaView.js (#38601) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38601 This file is forked in out of tree platforms as: - macOS > https://github.com/microsoft/react-native-macos/blob/main/Libraries/Components/SafeAreaView/SafeAreaView.js#L28-L33 - Windows > https://github.com/microsoft/react-native-windows/blob/0.71-stable/vnext/src/Libraries/Components/SafeAreaView/SafeAreaView.windows.js#L30-L36 The change here removes the need of forking this file Changelog: [General] [Fixed] - [SafeAreaView] Remove need for platform overrides in SafeAreaView.js Reviewed By: NickGerleman Differential Revision: D47734944 fbshipit-source-id: 84249a3b3e7e3807b3d5ee4bfa4b1cb140541b8b --- .../Libraries/Components/SafeAreaView/SafeAreaView.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js index b53774b38b5b88..3ce101533fe852 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -25,10 +25,9 @@ let exported: React.AbstractComponent>; * limitation of the screen, such as rounded corners or camera notches (aka * sensor housing area on iPhone X). */ -if (Platform.OS === 'android') { - exported = View; -} else { - exported = require('./RCTSafeAreaViewNativeComponent').default; -} +exported = Platform.select({ + ios: require('./RCTSafeAreaViewNativeComponent').default, + default: View, +}); export default exported;