From 40d2097d3e20d0a5d383d54053b644fdaabb0ddc Mon Sep 17 00:00:00 2001 From: Maxime Nory Date: Wed, 16 Jan 2019 12:31:47 -0800 Subject: [PATCH] RCTSafeAreaView (#23006) Summary: Part of #22990 Changelog: ---------- [iOS] [Changed] - Create individual `RCTSafeAreaViewNativeComponent` JS file from `SafeAreaView` with flow typing. Pull Request resolved: https://github.com/facebook/react-native/pull/23006 Reviewed By: TheSavior Differential Revision: D13690683 Pulled By: rickhanlonii fbshipit-source-id: 7928fabf0264a6269a41148432f604e82d9b3920 --- .../RCTSafeAreaViewNativeComponent.js | 25 +++++++++++++++++++ .../Components/SafeAreaView/SafeAreaView.js | 10 +++++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js diff --git a/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js b/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js new file mode 100644 index 00000000000000..250c2cd5c255be --- /dev/null +++ b/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js @@ -0,0 +1,25 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +const requireNativeComponent = require('requireNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {NativeComponent} from 'ReactNative'; + +type NativeProps = $ReadOnly<{| + ...ViewProps, + emulateUnlessSupported?: boolean, +|}>; + +type RCTSafeAreaViewNativeType = Class>; + +module.exports = ((requireNativeComponent( + 'RCTSafeAreaView', +): any): RCTSafeAreaViewNativeType); diff --git a/Libraries/Components/SafeAreaView/SafeAreaView.js b/Libraries/Components/SafeAreaView/SafeAreaView.js index 6f4ecf3ac867b4..916852aa42607d 100644 --- a/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -11,7 +11,6 @@ const Platform = require('Platform'); const React = require('React'); const View = require('View'); -const requireNativeComponent = require('requireNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; @@ -39,10 +38,15 @@ if (Platform.OS === 'android') { } }; } else { - const RCTSafeAreaView = requireNativeComponent('RCTSafeAreaView'); + const RCTSafeAreaViewNativeComponent = require('RCTSafeAreaViewNativeComponent'); exported = class SafeAreaView extends React.Component { render(): React.Node { - return ; + return ( + + ); } }; }