first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifndef RCT_DEPRECATED_DECLARATIONS
#define RCT_DEPRECATED_DECLARATIONS 0
#endif
#if RCT_DEPRECATED_DECLARATIONS
#define RCT_DEPRECATED __attribute__((deprecated))
#else
#define RCT_DEPRECATED
#endif

View File

@@ -0,0 +1,8 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Dummy file to make RCTDeprecation a valid framework.

View File

@@ -0,0 +1,25 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json")))
version = package['version']
Pod::Spec.new do |s|
s.name = "RCTDeprecation"
s.version = version
s.author = "Meta Platforms, Inc. and its affiliates"
s.license = package["license"]
s.homepage = "https://reactnative.dev/"
s.source = { :git => 'https://github.com/facebook/react-native.git', :tag => 'v#{version}' }
s.summary = "Macros for marking APIs as deprecated"
s.source_files = podspec_sources(["Exported/*.h", "RCTDeprecation.m"], "Exported/*.h")
s.pod_target_xcconfig = {
"DEFINES_MODULE" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard()
}
s.compiler_flags = "-Wnullable-to-nonnull-conversion -Wnullability-completeness"
end

View File

@@ -0,0 +1 @@
RCTDeprecation contains C macros to identify deprecated APIs at build-time.

View File

@@ -0,0 +1,12 @@
# RCTFoundation
RCTFoundation is a collection of lightweight utility libraries.
Rules for RCTFoundation libraries:
- They must only depend on other RCTFoundation libraries.
- Headers cannot contain C++.
- They have modular set to true in BUCK.
- They have complete_nullability set to true.
- They have enabled Clang compiler warnings.
- They have documentation.
- They have unit tests.

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#import <memory>
#import <string>
#import <Foundation/Foundation.h>
namespace facebook::react {
class CallInvoker;
class TurboModule;
} // namespace facebook::react
@interface RCTAnimatedModuleProvider : NSObject
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
jsInvoker:
(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker;
@end

View File

@@ -0,0 +1,94 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTAnimatedModuleProvider.h"
#import <functional>
#if TARGET_OS_OSX
#import <React/RCTPlatformDisplayLink.h>
#else
#import <QuartzCore/CADisplayLink.h>
#endif
#import <react/renderer/animated/AnimatedModule.h>
#import <react/renderer/animated/NativeAnimatedNodesManagerProvider.h>
@implementation RCTAnimatedModuleProvider {
#if TARGET_OS_OSX
RCTPlatformDisplayLink *_displayLink;
#else
CADisplayLink *_displayLink;
#endif
std::function<void()> _onRender;
}
- (void)_onDisplayLinkTick
{
if (_displayLink != nullptr && _onRender != nullptr) {
_onRender();
}
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
if (facebook::react::ReactNativeFeatureFlags::cxxNativeAnimatedEnabled()) {
if (name == facebook::react::AnimatedModule::kModuleName) {
__weak RCTAnimatedModuleProvider *weakSelf = self;
auto provider = std::make_shared<facebook::react::NativeAnimatedNodesManagerProvider>(
[weakSelf](std::function<void()> &&onRender, bool isAsync) {
const auto start_render = [weakSelf, onRender]() {
RCTAnimatedModuleProvider *strongSelf = weakSelf;
if (strongSelf) {
strongSelf->_onRender = onRender;
if (strongSelf->_displayLink == nil) {
#if TARGET_OS_OSX
strongSelf->_displayLink =
[RCTPlatformDisplayLink displayLinkWithTarget:strongSelf selector:@selector(_onDisplayLinkTick)];
#else
strongSelf->_displayLink = [CADisplayLink displayLinkWithTarget:strongSelf
selector:@selector(_onDisplayLinkTick)];
#endif
[strongSelf->_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
}
}
};
if (isAsync) {
dispatch_async(dispatch_get_main_queue(), ^{
start_render();
});
} else {
start_render();
}
},
[weakSelf](bool isAsync) {
const auto stop_render = [weakSelf]() {
RCTAnimatedModuleProvider *strongSelf = weakSelf;
if (strongSelf) {
if (strongSelf->_displayLink != nil) {
[strongSelf->_displayLink invalidate];
strongSelf->_displayLink = nil;
strongSelf->_onRender = nullptr;
}
}
};
if (isAsync) {
dispatch_async(dispatch_get_main_queue(), ^{
stop_render();
});
} else {
stop_render();
}
});
return std::make_shared<facebook::react::AnimatedModule>(std::move(jsInvoker), std::move(provider));
}
}
return nullptr;
}
@end

View File

@@ -0,0 +1,39 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
version = package['version']
source = { :git => '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 if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
Pod::Spec.new do |s|
s.name = "RCTSwiftUI"
s.version = version
s.summary = "Swift utilities for React Native."
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = "*.{h,m,swift}"
s.public_header_files = "*.h"
s.module_name = "RCTSwiftUI"
s.header_dir = "RCTSwiftUI"
# Swift-specific configuration
s.pod_target_xcconfig = {
"SWIFT_VERSION" => "5.0",
"DEFINES_MODULE" => "YES",
}
end

View File

@@ -0,0 +1,132 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import SwiftUI
import UIKit
@MainActor @objc public class RCTSwiftUIContainerView: NSObject {
private var containerViewModel = ContainerViewModel()
private var hostingController: UIHostingController<SwiftUIContainerView>?
@objc public override init() {
super.init()
hostingController = UIHostingController(rootView: SwiftUIContainerView(viewModel: containerViewModel))
guard let view = hostingController?.view else {
return
}
view.backgroundColor = .clear
}
@objc public func updateContentView(_ view: UIView) {
containerViewModel.contentView = view
}
@objc public func hostingView() -> UIView? {
return hostingController?.view
}
@objc public func contentView() -> UIView? {
return containerViewModel.contentView
}
@objc public func updateBlurRadius(_ radius: NSNumber) {
let blurRadius = CGFloat(radius.floatValue)
containerViewModel.blurRadius = blurRadius
}
@objc public func updateGrayscale(_ grayscale: NSNumber) {
containerViewModel.grayscale = CGFloat(grayscale.floatValue)
}
@objc public func updateDropShadow(standardDeviation: NSNumber, x: NSNumber, y: NSNumber, color: UIColor) {
containerViewModel.shadowRadius = CGFloat(standardDeviation.floatValue)
containerViewModel.shadowX = CGFloat(x.floatValue)
containerViewModel.shadowY = CGFloat(y.floatValue)
containerViewModel.shadowColor = Color(color)
}
@objc public func updateSaturation(_ saturation: NSNumber) {
containerViewModel.saturationAmount = CGFloat(saturation.floatValue)
}
@objc public func updateContrast(_ contrast: NSNumber) {
containerViewModel.contrastAmount = CGFloat(contrast.floatValue)
}
@objc public func updateHueRotate(_ degrees: NSNumber) {
containerViewModel.hueRotationDegrees = CGFloat(degrees.floatValue)
}
@objc public func updateLayout(withBounds bounds: CGRect) {
hostingController?.view.frame = bounds
containerViewModel.contentView?.frame = bounds
}
@objc public func resetStyles() {
containerViewModel.blurRadius = 0
containerViewModel.grayscale = 0
containerViewModel.shadowRadius = 0
containerViewModel.shadowX = 0
containerViewModel.shadowY = 0
containerViewModel.shadowColor = Color.clear
containerViewModel.saturationAmount = 1
containerViewModel.contrastAmount = 1
containerViewModel.hueRotationDegrees = 0
}
}
class ContainerViewModel: ObservableObject {
// blur filter properties
@Published var blurRadius: CGFloat = 0
// grayscale filter properties
@Published var grayscale: CGFloat = 0
// drop-shadow filter properties
@Published var shadowRadius: CGFloat = 0
@Published var shadowX: CGFloat = 0
@Published var shadowY: CGFloat = 0
@Published var shadowColor: Color = Color.clear
// saturation filter properties
@Published var saturationAmount: CGFloat = 1
// contrast filter properties
@Published var contrastAmount: CGFloat = 1
// hue-rotate filter properties
@Published var hueRotationDegrees: CGFloat = 0
@Published var contentView: UIView?
}
struct SwiftUIContainerView: View {
@ObservedObject var viewModel: ContainerViewModel
var body: some View {
if let contentView = viewModel.contentView {
UIViewWrapper(view: contentView)
.blur(radius: viewModel.blurRadius)
.grayscale(viewModel.grayscale)
.shadow(color: viewModel.shadowColor, radius: viewModel.shadowRadius, x: viewModel.shadowX, y: viewModel.shadowY)
.saturation(viewModel.saturationAmount)
.contrast(viewModel.contrastAmount)
.hueRotation(.degrees(viewModel.hueRotationDegrees))
}
}
}
struct UIViewWrapper: UIViewRepresentable {
let view: UIView
func makeUIView(context: Context) -> UIView {
return view
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface RCTSwiftUIContainerViewWrapper : NSObject
- (UIView *_Nullable)contentView;
- (void)updateBlurRadius:(NSNumber *)radius;
- (void)updateGrayscale:(NSNumber *)grayscale;
- (void)updateDropShadow:(NSNumber *)standardDeviation x:(NSNumber *)x y:(NSNumber *)y color:(UIColor *)color;
- (void)updateSaturation:(NSNumber *)saturation;
- (void)updateContrast:(NSNumber *)contrast;
- (void)updateHueRotate:(NSNumber *)degrees;
- (void)updateContentView:(UIView *)view;
- (UIView *_Nullable)hostingView;
- (void)resetStyles;
- (void)updateLayoutWithBounds:(CGRect)bounds;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSwiftUIContainerViewWrapper.h"
@import RCTSwiftUI;
@interface RCTSwiftUIContainerViewWrapper ()
@property (nonatomic, strong) RCTSwiftUIContainerView *swiftContainerView;
@end
@implementation RCTSwiftUIContainerViewWrapper
- (instancetype)init
{
if (self = [super init]) {
_swiftContainerView = [RCTSwiftUIContainerView new];
}
return self;
}
- (UIView *_Nullable)contentView
{
return [self.swiftContainerView contentView];
}
- (UIView *_Nullable)hostingView
{
return [self.swiftContainerView hostingView];
}
- (void)resetStyles
{
[self.swiftContainerView resetStyles];
}
- (void)updateContentView:(UIView *)view
{
return [self.swiftContainerView updateContentView:view];
}
- (void)updateBlurRadius:(NSNumber *)radius
{
[self.swiftContainerView updateBlurRadius:radius];
}
- (void)updateGrayscale:(NSNumber *)grayscale
{
[self.swiftContainerView updateGrayscale:grayscale];
}
- (void)updateSaturation:(NSNumber *)saturation
{
[self.swiftContainerView updateSaturation:saturation];
}
- (void)updateContrast:(NSNumber *)contrast
{
[self.swiftContainerView updateContrast:contrast];
}
- (void)updateHueRotate:(NSNumber *)degrees
{
[self.swiftContainerView updateHueRotate:degrees];
}
- (void)updateDropShadow:(NSNumber *)standardDeviation x:(NSNumber *)x y:(NSNumber *)y color:(UIColor *)color
{
[self.swiftContainerView updateDropShadowWithStandardDeviation:standardDeviation x:x y:y color:color];
}
- (void)updateLayoutWithBounds:(CGRect)bounds
{
[self.swiftContainerView updateLayoutWithBounds:bounds];
}
@end

View File

@@ -0,0 +1,38 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
version = package['version']
source = { :git => '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 if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
Pod::Spec.new do |s|
s.name = "RCTSwiftUIWrapper"
s.version = version
s.summary = "Swift utilities for React Native."
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = "*.{h,m}"
s.public_header_files = "*.h"
s.module_name = "RCTSwiftUIWrapper"
s.header_dir = "RCTSwiftUIWrapper"
s.dependency "RCTSwiftUI"
s.pod_target_xcconfig = {
"SWIFT_VERSION" => "5.0",
}
end

5
node_modules/react-native/ReactApple/README.md generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# ReactApple
ReactApple contains code to ship React Native apps to Apple devices. The dominant language is Objective-C.
New libraries built with Apple frameworks or intended to ship to Apple devices should live in this directory.