Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabric: working podspecs & works in RNTester #23803

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
58906c9
working podspec with no hacks!
ericlewis Mar 7, 2019
0875260
Hacks necessary to run in RNTester
ericlewis Mar 7, 2019
96e3e58
Allow codegen components back in
ericlewis Mar 7, 2019
aa9e8d4
Don’t merge: Commit codegen’d component refs.
ericlewis Mar 7, 2019
fd1c7d9
Use strikethrough instead of line-through
ericlewis Mar 7, 2019
4e76563
use codegen when install pods
ericlewis Mar 8, 2019
63c17c9
Fix shell lint
ericlewis Mar 8, 2019
d00b345
fix alphanumeric handling of filenames
ericlewis Mar 8, 2019
1c57282
Fix script
ericlewis Mar 12, 2019
eecc1f6
remove hacks to internals
ericlewis Mar 12, 2019
51c6997
Swizzle fabric methods so we don’t crash.
ericlewis Mar 12, 2019
f64646b
remove shim hack, use flag to indicate fabric.
ericlewis Mar 12, 2019
45062d1
Clean-up podspecs
ericlewis Mar 12, 2019
cde57e8
use a diff podspec for folly on fabric
ericlewis Mar 13, 2019
6df82b9
Fix header search paths
ericlewis Mar 13, 2019
aec36fd
Revert "Use strikethrough instead of line-through"
ericlewis Mar 13, 2019
4ebf5a7
vastly simpler folly podspec
ericlewis Mar 13, 2019
c590e9c
Feature flag fabric, remove enable by default.
ericlewis Mar 13, 2019
d9ba285
Add comment to generate-rncore.sh
ericlewis Mar 13, 2019
b511635
create fabric subspec for folly
ericlewis Mar 13, 2019
5d6872f
Update podlock
ericlewis Mar 13, 2019
d345857
add copyright header
ericlewis Mar 13, 2019
8a68949
Silence warning, names won’t be non-alphanumberic
ericlewis Mar 13, 2019
5279477
Fix missing run scheme
ericlewis Mar 13, 2019
707af1b
update folly podspec
ericlewis Mar 13, 2019
3235db2
Update react-fabric folly dep
ericlewis Mar 13, 2019
7eec116
fix style nit
ericlewis Mar 14, 2019
9676dfd
Update fixme to point to issue
ericlewis Mar 14, 2019
d2671a9
Add revisit todos to weakObject implementations
ericlewis Mar 14, 2019
b40483b
Flag nit
ericlewis Mar 14, 2019
043694a
JSI: flag fabric specific code
ericlewis Mar 14, 2019
31c110c
Fix header
ericlewis Mar 14, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions RNTester/ComponentRegistry.cpp
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
7 changes: 7 additions & 0 deletions RNTester/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ target 'RNTester' do
pod 'React-RCTVibration', :path => '../Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../Libraries/WebSocket'

# Fabric Pods, uncomment these to enable in RNTester
# pod 'React-Fabric', :path => '../ReactCommon'
# pod 'React-graphics', :path => '../ReactCommon/fabric/graphics'
# pod 'React-jsi/Fabric', :path => '../ReactCommon/jsi'
# pod 'React-RCTFabric', :path => '../React'
# pod 'Folly/Fabric', :podspec => '../third-party-podspecs/Folly.podspec'

pod 'React-cxxreact', :path => '../ReactCommon/cxxreact'
pod 'React-jsi', :path => '../ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../ReactCommon/jsiexecutor'
Expand Down
61 changes: 33 additions & 28 deletions RNTester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ PODS:
- boost-for-react-native (1.63.0)
- DoubleConversion (1.1.6)
- Folly (2018.10.22.00):
- boost-for-react-native
- DoubleConversion
- Folly/Default (= 2018.10.22.00)
- glog
- Folly/Default (2018.10.22.00):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this an extra alias? I don't see it used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a Default subspec, so that Folly doesn't install the fabric subspec automatically as well. It is a no-op technically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make it so that it's not a no-op but actually controls what is built. I decided against this originally to prevent any mistakes from developers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to keep default as a no-op, so user's can't accidentally forget to install Folly normally.

- boost-for-react-native
- DoubleConversion
- glog
Expand Down Expand Up @@ -170,33 +175,33 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: 3eb87e5bfd9737e9a8cc698f74ee064d00c8dafc
Folly: de497beb10f102453a1afa9edbf8cf8a251890de
glog: aefd1eb5dda2ab95ba0938556f34b98e2da3a60d
React: 4d01f91757abcfd2adccf80248285957ac1a2de2
React-ART: f03123e0f0b9850db4733ad94ded11d29c719dc6
React-Core: fcb8a6f34de5a43426efcb9dfda6a434c1b1275d
React-cxxreact: 2a2acf4466abf5b794da53bf69e757a885259452
React-DevSupport: 140c1ccfa9ccba495977225c117dc78c8858224f
React-fishhook: aefe3414f44d4deaa880f0e39dc76644f1072bf7
React-jsi: 425cd468e0be54cdc9009a2b4d2c1a4eada83805
React-jsiexecutor: 520560a0b08226e4e758645940253e270b4d7d76
React-jsinspector: c9020e3a37b7b27125d824b1d02b9be0d1c737ac
React-RCTActionSheet: 78b940169b3c12d199dbbd382c5a3d22ec2197e2
React-RCTAnimation: da0026d00ed99669b6175a941189539d8f9d52a4
React-RCTBlob: c5a2104bd8b8e0462fc35eefa9133dc04ced56dd
React-RCTCameraRoll: effa220c8e244af93b44011ab85cab814c469e08
React-RCTGeolocation: 3517483e877750bae5a03d9f52e7b0e48c49651e
React-RCTImage: ed045a58ebc9c97870a4fe5d066fdf04f247023b
React-RCTLinking: e5f174d3f9e6ffe30087b9edc8c9860d62c1413c
React-RCTNetwork: 9fbf72be6083a4b5fffe3dc1afad9fa2b70c4f19
React-RCTPushNotification: 106e9846882a8dcce372fc90531be996ce0bb29b
React-RCTSettings: afd7ae33bacd09b12c8a0d3151069d465344ce24
React-RCTText: 03945b44521b34f89f9a728e1c265fa096af9f94
React-RCTVibration: ef9e4e077360a599a1b59cee7d18398871d37759
React-RCTWebSocket: 510a4eef2c064ef30508aba41628e6d69f4df4c5
yoga: c63f2cb4fd93594d29e792c198a8050d5daf9fdf
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
Folly: 1be1411eb14d534b6f51f44bc811dce5b2f0f229
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
React: 7aad3f59955ea370fc703a3657e944183863d3be
React-ART: a8c11f5beb8c69eb330b476fd563cc13b40a93f8
React-Core: fed95a79b93f5ff85875f6ad5b1475081e7a363f
React-cxxreact: a3e519e0d39e82f9225ad38169c760c6a35ec3eb
React-DevSupport: cdf21dec6137ae943beb2b064a2f3b03fe42793a
React-fishhook: 6e7fa5c37e43794a4b70c7a2d47edd89b7c8a45b
React-jsi: 069516b26f41499561a65436efb48882ae3cc671
React-jsiexecutor: acc5c03bf10f490579ffc656e787f3b3fa4ad4b2
React-jsinspector: 95a00e9bd14df84911e19fdec0adced353ae641c
React-RCTActionSheet: 6257f5327ab71704471bda341ce281678d54e5ef
React-RCTAnimation: 6d90377d0ed64ca03a352354a1f95b5393d74072
React-RCTBlob: 8c2e2cf3ac73abb131cda45b6a83dd6f89ecc004
React-RCTCameraRoll: eeea5d12b256395f07313e054a633ae4fb81f663
React-RCTGeolocation: 4bc4e5a0950c7dc64b6521ca09564f34753b4809
React-RCTImage: 2752fe4b2bbd50cf91000ed077c7a000d478fa0b
React-RCTLinking: 07ed1bb2d00e0752596eeada1cb7d88580c201dd
React-RCTNetwork: 6175132114a74f1cc2e720041243aa102ed79a5a
React-RCTPushNotification: 0229f65c8bb7d5977df3d9bbada445efecd5f755
React-RCTSettings: 413020eb1f69fa966a9dfe0e805126ac56a611e7
React-RCTText: 0c53ea37f2ca02670dd428b02b42bd45bdde3058
React-RCTVibration: feb883529cd412d9fb61276129759a02c15cc6a6
React-RCTWebSocket: 486e431c4bfb37531ad992fe4470a13ca6b5dc48
yoga: dcb354a1211e870c6ce5694eddefecf7c2d40632

PODFILE CHECKSUM: c144025e9b0ade3d8b536a343fee89da69391cdc
PODFILE CHECKSUM: e9dd395fa995427b195fba8fd8f58d54c2851bb9

COCOAPODS: 1.6.0
COCOAPODS: 1.6.1
51 changes: 43 additions & 8 deletions RNTester/RNTester/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,54 @@
#import <React/RCTPushNotificationManager.h>
#endif

@interface AppDelegate() <RCTBridgeDelegate>
#ifdef RN_FABRIC_ENABLED
#import <React/RCTSurfacePresenter.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>

@interface AppDelegate() <RCTBridgeDelegate>{
RCTSurfacePresenter *_surfacePresenter;
}
@end

// FIXME: remove when resolved https://github.com/facebook/react-native/issues/23910
@interface RCTSurfacePresenter ()
-(void)_startAllSurfaces;
@end

#else
@interface AppDelegate() <RCTBridgeDelegate>
@end
#endif

@implementation AppDelegate

- (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_bridge = [[RCTBridge alloc] initWithDelegate:self
launchOptions:launchOptions];

// Appetizer.io params check
NSDictionary *initProps = nil;
NSDictionary *initProps = @{};
NSString *_routeUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"route"];
if (_routeUri) {
initProps = @{@"exampleFromAppetizeParams": [NSString stringWithFormat:@"rntester://example/%@Example", _routeUri]};
}

RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:_bridge
moduleName:@"RNTesterApp"
initialProperties:initProps];


#ifdef RN_FABRIC_ENABLED
// FIXME: remove when resolved https://github.com/facebook/react-native/issues/23910
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleJavaScriptDidLoadNotification:)
name:RCTJavaScriptDidLoadNotification
object:_bridge];

_surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge config:nil];
_bridge.surfacePresenter = _surfacePresenter;

UIView *rootView = [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
ericlewis marked this conversation as resolved.
Show resolved Hide resolved
#else
UIView *rootView = [[RCTRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
#endif

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
Expand All @@ -48,6 +74,15 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith
return YES;
}

#ifdef RN_FABRIC_ENABLED
// FIXME: remove when resolved https://github.com/facebook/react-native/issues/23910
- (void)handleJavaScriptDidLoadNotification:(__unused NSNotification*)notification {
dispatch_async(dispatch_get_main_queue(), ^{
[self->_surfacePresenter _startAllSurfaces];
});
}
#endif

- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
{
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"RNTester/js/RNTesterApp.ios"
Expand Down
Loading