-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fabric: working podspecs & works in RNTester (#23803)
Summary: This is the couple of hacks I used after I finished #23802 in order to get fabric working on RNTester. This is inspired from prior work by kmagiera. The goal of this PR is to show others what I’m struggling with, and to eventually merge it sans hacks. - Yarn Install - Uncomment the commented out pods in RNTester's pod file - Open RNTesterPods workspace - Run App - this is only for pods, the non-pod RNTester will no longer work until updated with fabric too. - `SurfaceHostingView` & `SurfaceHostingProxyRootView` both try to start the surface immediately, this leads to a race condition due to the javascript not having loaded yet, the hack here is: 1. Swizzle the `start` method on `RCTFabricSurface` to no-op when called. 2. Add observer for `RCTJavaScriptDidLoadNotification` 3. Call private method `_startAllSurfaces` on `_surfacePresenter` in AppDelegate when we receive `RCTJavaScriptDidLoadNotification`. [General] [Added] - Use Fabric in RNTester Pull Request resolved: #23803 Reviewed By: shergin, mdvacca Differential Revision: D14450726 Pulled By: fkgozali fbshipit-source-id: 8ae2d48634fecb60db539aaf0a2c89ba1f572c27
- Loading branch information
1 parent
845189c
commit 97e6ea1
Showing
18 changed files
with
672 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
#ifdef RN_FABRIC_ENABLED | ||
#include <react/uimanager/ComponentDescriptorFactory.h> | ||
#include <react/uimanager/ComponentDescriptorRegistry.h> | ||
#include <react/uimanager/ContextContainer.h> | ||
|
||
#include <react/config/ReactNativeConfig.h> | ||
#include <react/components/image/ImageComponentDescriptor.h> | ||
#include <react/components/scrollview/ScrollViewComponentDescriptor.h> | ||
#include <react/components/rncore/ComponentDescriptors.h> | ||
#include <react/components/text/ParagraphComponentDescriptor.h> | ||
#include <react/components/text/RawTextComponentDescriptor.h> | ||
#include <react/components/text/TextComponentDescriptor.h> | ||
#include <react/components/view/ViewComponentDescriptor.h> | ||
#include <react/components/slider/SliderComponentDescriptor.h> | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
/** | ||
* This is a sample implementation. Each app should provide its own. | ||
*/ | ||
ComponentRegistryFactory getDefaultComponentRegistryFactory() { | ||
return [](const EventDispatcher::Shared &eventDispatcher, | ||
const SharedContextContainer &contextContainer) { | ||
auto registry = std::make_shared<ComponentDescriptorRegistry>(); | ||
registry->registerComponentDescriptor(std::make_shared<ViewComponentDescriptor>(eventDispatcher)); | ||
registry->registerComponentDescriptor(std::make_shared<ImageComponentDescriptor>(eventDispatcher, contextContainer)); | ||
registry->registerComponentDescriptor(std::make_shared<ScrollViewComponentDescriptor>(eventDispatcher)); | ||
registry->registerComponentDescriptor(std::make_shared<ParagraphComponentDescriptor>(eventDispatcher, contextContainer)); | ||
registry->registerComponentDescriptor(std::make_shared<TextComponentDescriptor>(eventDispatcher)); | ||
registry->registerComponentDescriptor(std::make_shared<RawTextComponentDescriptor>(eventDispatcher)); | ||
registry->registerComponentDescriptor(std::make_shared<ActivityIndicatorViewComponentDescriptor>(eventDispatcher)); | ||
registry->registerComponentDescriptor(std::make_shared<SwitchComponentDescriptor>(eventDispatcher)); | ||
registry->registerComponentDescriptor(std::make_shared<SliderComponentDescriptor>(eventDispatcher, contextContainer)); | ||
return registry; | ||
}; | ||
} | ||
|
||
} // namespace react | ||
} // namespace facebook | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.