Skip to content

Commit

Permalink
For Fabric with StaticViewConfigs, fix UIManager to use LazyUImanager…
Browse files Browse the repository at this point in the history
…, not PaperUIManager

Summary: Changelog: [JS] For Fabric with StaticViewConfigs, fix UIManager to use LazyUImanager, not PaperUIManager

Reviewed By: fkgozali

Differential Revision: D33459937

fbshipit-source-id: 4298be7e1e455856cbcf3162b100099cd8c9ce09
  • Loading branch information
p-sun authored and facebook-github-bot committed Jan 8, 2022
1 parent 705236e commit 9daae5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
19 changes: 11 additions & 8 deletions Libraries/ReactNative/UIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
* @format
*/

import UIManagerInjection from './UIManagerInjection';
import type {Spec} from './NativeUIManager';
import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes';

interface UIManagerJSInterface extends Spec {
export interface UIManagerJSInterface extends Spec {
+getViewManagerConfig: (viewManagerName: string) => Object;
+hasViewManagerConfig: (viewManagerName: string) => boolean;
+createView: (
Expand All @@ -32,11 +31,15 @@ interface UIManagerJSInterface extends Spec {
) => void;
}

const UIManager: UIManagerJSInterface =
global.RN$Bridgeless === true
? require('./DummyUIManager') // No UIManager in bridgeless mode
: UIManagerInjection.unstable_UIManager == null
? require('./PaperUIManager')
: UIManagerInjection.unstable_UIManager;
var UIManager: UIManagerJSInterface;
if (global.RN$Bridgeless === true) {
// $FlowExpectedError[incompatible-type]
UIManager = require('./DummyUIManager');
} else {
const {unstable_UIManager} = require('./UIManagerInjection');
UIManager = unstable_UIManager
? unstable_UIManager
: require('./PaperUIManager');
}

module.exports = UIManager;
8 changes: 5 additions & 3 deletions Libraries/ReactNative/UIManagerInjection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @format
*/

export default {
unstable_UIManager: (null: ?any),
};
import type {UIManagerJSInterface} from './UIManager';

const unstable_UIManager: ?UIManagerJSInterface = null;

export {unstable_UIManager};

0 comments on commit 9daae5a

Please sign in to comment.