Skip to content

Commit

Permalink
chore: add FullWindowOverlay to Fabric JS
Browse files Browse the repository at this point in the history
  • Loading branch information
kkafar committed Jun 28, 2022
1 parent 0433b38 commit e8f6163
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/fabric/FullWindowOverlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import FullWindowOverlayNativeComponent from './FullWindowOverlayNativeComponent';

function FullWindowOverlay(props) {
return (
<FullWindowOverlayNativeComponent
{...props}
style={[{ flex: 1 }, props.style]}
/>
);
}

export default FullWindowOverlay;
19 changes: 19 additions & 0 deletions src/fabric/FullWindowOverlayNativeComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @flow strict-local
* @format
*/
/* eslint-disable */
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';

type NativeProps = $ReadOnly<{|
...ViewProps,
|}>;

type ComponentType = HostComponent<NativeProps>;

export default (codegenNativeComponent<NativeProps>(
'RNSFullWindowOverlay',
{}
): ComponentType);
2 changes: 2 additions & 0 deletions src/fabric/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ScreenStack from './ScreenStack';
import SearchBar from './SearchBar';
import ScreenContainer from './ScreenContainer';
import ScreenNavigationContainer from './ScreenNavigationContainer';
import FullWindowOverlay from './FullWindowOverlay';

export {
Screen,
Expand All @@ -14,4 +15,5 @@ export {
SearchBar,
ScreenContainer,
ScreenNavigationContainer,
FullWindowOverlay,
};
4 changes: 3 additions & 1 deletion src/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ const ScreensNativeModules = {

get NativeFullWindowOverlay() {
NativeFullWindowOverlay =
NativeFullWindowOverlay || requireNativeComponent('RNSFullWindowOverlay');
NativeFullWindowOverlay ||
FabricComponents.FullWindowOverlay ||
requireNativeComponent('RNSFullWindowOverlay');
return NativeFullWindowOverlay;
},
};
Expand Down

0 comments on commit e8f6163

Please sign in to comment.