Extract use of renderer to its own module

Summary:
This diff creates a proxy module to interact with the React Native renderer. The goal of this proxy is to decouple usages of several functions (e.g.: `findNodeHandle`, etc.) from the actual renderer used in an app. This way, we can easily switch between renderers without having to change code depending on it.

This will be useful to remove a specific renderer from an app bundle when it's no longer used (e.g.: Paper on the Facebook App).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D39205975

fbshipit-source-id: 05289c0c3c8cd26d81aa1d2163097c73ec40c6ad
This commit is contained in:
Rubén Norte
2022-09-08 11:12:06 -07:00
committed by Facebook GitHub Bot
parent 5efb4f09fd
commit b06cae3681
6 changed files with 177 additions and 45 deletions
@@ -10,14 +10,13 @@
'use strict';
const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge');
const React = require('react');
const renderApplication = require('react-native/Libraries/ReactNative/renderApplication');
const {StyleSheet, Text, View} = require('react-native');
import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes';
import * as React from 'react';
import {StyleSheet, Text, View} from 'react-native';
import BatchedBridge from 'react-native/Libraries/BatchedBridge/BatchedBridge';
import renderApplication from 'react-native/Libraries/ReactNative/renderApplication';
type FlexTestAppProps = $ReadOnly<{||}>;
class FlexTestApp extends React.Component<FlexTestAppProps> {
render(): React.Node {
@@ -267,4 +266,4 @@ BatchedBridge.registerCallableModule(
UIManagerTestModule,
);
module.exports = UIManagerTestModule;
export default UIManagerTestModule;