mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix SafeAreaView mis-used import (#46402)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46402 JS code for importing SafeAreaView is causing error in windows due to import being used. Fix it by using conditional require instead Changelog: [Internal] - Fixed mis-used import of core only SafeAreaView in JS Reviewed By: fkgozali Differential Revision: D62392588 fbshipit-source-id: 65c4728ff73b43cc54543ec2d141a88fce1275ca
This commit is contained in:
committed by
Facebook GitHub Bot
parent
84f2d25124
commit
af1b18e125
+11
-9
@@ -13,15 +13,17 @@ import type {ViewProps} from '../../../Libraries/Components/View/ViewPropTypes';
|
||||
import Platform from '../../../Libraries/Utilities/Platform';
|
||||
import View from '../../../Libraries/Components/View/View';
|
||||
import * as React from 'react';
|
||||
export * from '../../../src/private/specs/components/RCTSafeAreaViewNativeComponent';
|
||||
import RCTSafeAreaViewNativeComponent from '../../../src/private/specs/components/RCTSafeAreaViewNativeComponent';
|
||||
|
||||
let exported: React.AbstractComponent<ViewProps, React.ElementRef<typeof View>>;
|
||||
|
||||
if (Platform.OS === 'android' || Platform.OS === 'ios') {
|
||||
exported = RCTSafeAreaViewNativeComponent;
|
||||
} else {
|
||||
exported = View;
|
||||
}
|
||||
const exported: React.AbstractComponent<
|
||||
ViewProps,
|
||||
React.ElementRef<typeof View>,
|
||||
> = Platform.select({
|
||||
ios: require('../../../src/private/specs/components/RCTSafeAreaViewNativeComponent')
|
||||
.default,
|
||||
android:
|
||||
require('../../../src/private/specs/components/RCTSafeAreaViewNativeComponent')
|
||||
.default,
|
||||
default: View,
|
||||
});
|
||||
|
||||
export default exported;
|
||||
|
||||
Reference in New Issue
Block a user