mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
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: https://github.com/facebook/react-native/pull/23803 Reviewed By: shergin, mdvacca Differential Revision: D14450726 Pulled By: fkgozali fbshipit-source-id: 8ae2d48634fecb60db539aaf0a2c89ba1f572c27
54 lines
2.1 KiB
Ruby
54 lines
2.1 KiB
Ruby
# 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.
|
||
|
||
package = JSON.parse(File.read(File.expand_path('../../package.json', __dir__)))
|
||
version = package['version']
|
||
|
||
source = { :git => ENV['INSTALL_YOGA_FROM_LOCATION'] || 'https://github.com/facebook/react-native.git' }
|
||
if version == '1000.0.0'
|
||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
||
source[:commit] = `git rev-parse HEAD`.strip
|
||
else
|
||
source[:tag] = "v#{version}"
|
||
end
|
||
|
||
Pod::Spec.new do |spec|
|
||
spec.name = 'yoga'
|
||
spec.version = "#{version}.React"
|
||
spec.license = { :type => 'MIT' }
|
||
spec.homepage = 'https://yogalayout.com'
|
||
spec.documentation_url = 'https://yogalayout.com/docs/'
|
||
|
||
spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.'
|
||
spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.'
|
||
|
||
spec.authors = 'Facebook'
|
||
spec.source = source
|
||
|
||
spec.module_name = 'yoga'
|
||
spec.requires_arc = false
|
||
spec.compiler_flags = [
|
||
'-fno-omit-frame-pointer',
|
||
'-fexceptions',
|
||
'-Wall',
|
||
'-Werror',
|
||
'-std=c++1y',
|
||
'-fPIC'
|
||
]
|
||
|
||
# Pinning to the same version as React.podspec.
|
||
spec.platforms = { :ios => "9.0", :tvos => "9.2" }
|
||
|
||
# Set this environment variable when *not* using the `:path` option to install the pod.
|
||
# E.g. when publishing this spec to a spec repo.
|
||
source_files = 'yoga/**/*.{cpp,h}'
|
||
source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
|
||
spec.source_files = source_files
|
||
|
||
header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue,YGStyle,CompactValue,YGFloatOptional,Yoga-internal,YGNode,YGConfig,YGLayout,YGMarker}.h'
|
||
header_files = File.join('ReactCommon/yoga', header_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
|
||
spec.public_header_files = header_files
|
||
end
|