Skip to content

Commit 49dca82

Browse files
committed
first commit.
0 parents  commit 49dca82

File tree

348 files changed

+53939
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

348 files changed

+53939
-0
lines changed

React.podspec

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
2+
3+
Pod::Spec.new do |s|
4+
s.name = "React"
5+
s.version = "0.44.0"
6+
s.summary = "React Native iOS Runtime"
7+
s.description = <<-DESC
8+
React Native apps are built using the React JS
9+
framework, and render directly to native UIKit
10+
elements using a fully asynchronous architecture.
11+
There is no browser and no HTML. We have picked what
12+
we think is the best set of features from these and
13+
other technologies to build what we hope to become
14+
the best product development framework available,
15+
with an emphasis on iteration speed, developer
16+
delight, continuity of technology, and absolutely
17+
beautiful and fast products with no compromises in
18+
quality or capability.
19+
DESC
20+
s.homepage = "http://facebook.github.io/react-native/"
21+
s.license = "BSD"
22+
s.author = "Facebook"
23+
s.source = { :git => "https://github.com/yyued/react-native-runtime-ios.git", :tag => s.version }
24+
s.default_subspec = "Core"
25+
s.requires_arc = true
26+
s.platform = :ios, "8.0"
27+
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
28+
s.preserve_paths = "package.json", "LICENSE", "LICENSE-CustomComponents", "PATENTS"
29+
s.cocoapods_version = ">= 1.2.0"
30+
31+
s.subspec "Core" do |ss|
32+
ss.dependency "Yoga"
33+
ss.dependency "React/cxxreact"
34+
ss.source_files = "React/**/*.{c,h,m,mm,S}"
35+
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/DevSupport/*", "React/Modules/RCTDev{LoadingView,Menu}.*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*"
36+
ss.framework = "JavaScriptCore"
37+
ss.libraries = "stdc++"
38+
end
39+
40+
s.subspec "DevSupport" do |ss|
41+
ss.dependency "React/Core"
42+
ss.dependency "React/RCTWebSocket"
43+
ss.source_files = "React/DevSupport/*", "React/Modules/RCTDev{LoadingView,Menu}.*"
44+
end
45+
46+
s.subspec "tvOS" do |ss|
47+
ss.dependency "React/Core"
48+
ss.source_files = "React/**/RCTTVView.{h, m}"
49+
end
50+
51+
s.subspec "jschelpers" do |ss|
52+
ss.source_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.{cpp,h}", "ReactCommon/jschelpers/systemJSCWrapper.cpp"
53+
ss.private_header_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.h"
54+
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
55+
ss.framework = "JavaScriptCore"
56+
end
57+
58+
s.subspec "cxxreact" do |ss|
59+
ss.dependency "React/jschelpers"
60+
ss.source_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.{cpp,h}"
61+
ss.private_header_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.h"
62+
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
63+
end
64+
65+
s.subspec "ART" do |ss|
66+
ss.dependency "React/Core"
67+
ss.source_files = "Libraries/ART/**/*.{h,m}"
68+
end
69+
70+
s.subspec "RCTActionSheet" do |ss|
71+
ss.dependency "React/Core"
72+
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}"
73+
end
74+
75+
s.subspec "RCTAdSupport" do |ss|
76+
ss.dependency "React/Core"
77+
ss.source_files = "Libraries/AdSupport/*.{h,m}"
78+
end
79+
80+
s.subspec "RCTAnimation" do |ss|
81+
ss.dependency "React/Core"
82+
ss.source_files = "Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h,m}"
83+
ss.header_dir = "RCTAnimation"
84+
end
85+
86+
s.subspec "RCTCameraRoll" do |ss|
87+
ss.dependency "React/Core"
88+
ss.dependency "React/RCTImage"
89+
ss.source_files = "Libraries/CameraRoll/*.{h,m}"
90+
end
91+
92+
s.subspec "RCTGeolocation" do |ss|
93+
ss.dependency "React/Core"
94+
ss.source_files = "Libraries/Geolocation/*.{h,m}"
95+
end
96+
97+
s.subspec "RCTImage" do |ss|
98+
ss.dependency "React/Core"
99+
ss.dependency "React/RCTNetwork"
100+
ss.source_files = "Libraries/Image/*.{h,m}"
101+
end
102+
103+
s.subspec "RCTNetwork" do |ss|
104+
ss.dependency "React/Core"
105+
ss.source_files = "Libraries/Network/*.{h,m,mm}"
106+
end
107+
108+
s.subspec "RCTPushNotification" do |ss|
109+
ss.dependency "React/Core"
110+
ss.source_files = "Libraries/PushNotificationIOS/*.{h,m}"
111+
end
112+
113+
s.subspec "RCTSettings" do |ss|
114+
ss.dependency "React/Core"
115+
ss.source_files = "Libraries/Settings/*.{h,m}"
116+
end
117+
118+
s.subspec "RCTText" do |ss|
119+
ss.dependency "React/Core"
120+
ss.source_files = "Libraries/Text/*.{h,m}"
121+
end
122+
123+
s.subspec "RCTVibration" do |ss|
124+
ss.dependency "React/Core"
125+
ss.source_files = "Libraries/Vibration/*.{h,m}"
126+
end
127+
128+
s.subspec "RCTWebSocket" do |ss|
129+
ss.dependency "React/Core"
130+
ss.source_files = "Libraries/WebSocket/*.{h,m}"
131+
end
132+
133+
s.subspec "RCTLinkingIOS" do |ss|
134+
ss.dependency "React/Core"
135+
ss.source_files = "Libraries/LinkingIOS/*.{h,m}"
136+
end
137+
138+
s.subspec "RCTTest" do |ss|
139+
ss.dependency "React/Core"
140+
ss.source_files = "Libraries/RCTTest/**/*.{h,m}"
141+
ss.frameworks = "XCTest"
142+
end
143+
144+
end

React/Base/RCTAssert.h

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import <Foundation/Foundation.h>
11+
12+
#import <React/RCTDefines.h>
13+
14+
/*
15+
* Defined in RCTUtils.m
16+
*/
17+
RCT_EXTERN BOOL RCTIsMainQueue(void);
18+
19+
/**
20+
* This is the main assert macro that you should use. Asserts should be compiled out
21+
* in production builds. You can customize the assert behaviour by setting a custom
22+
* assert handler through `RCTSetAssertFunction`.
23+
*/
24+
#ifndef NS_BLOCK_ASSERTIONS
25+
#define RCTAssert(condition, ...) do { \
26+
if ((condition) == 0) { \
27+
_RCTAssertFormat(#condition, __FILE__, __LINE__, __func__, __VA_ARGS__); \
28+
if (RCT_NSASSERT) { \
29+
[[NSAssertionHandler currentHandler] handleFailureInFunction:@(__func__) \
30+
file:@(__FILE__) lineNumber:__LINE__ description:__VA_ARGS__]; \
31+
} \
32+
} \
33+
} while (false)
34+
#else
35+
#define RCTAssert(condition, ...) do {} while (false)
36+
#endif
37+
RCT_EXTERN void _RCTAssertFormat(
38+
const char *, const char *, int, const char *, NSString *, ...
39+
) NS_FORMAT_FUNCTION(5,6);
40+
41+
/**
42+
* Report a fatal condition when executing. These calls will _NOT_ be compiled out
43+
* in production, and crash the app by default. You can customize the fatal behaviour
44+
* by setting a custom fatal handler through `RCTSetFatalHandler`.
45+
*/
46+
RCT_EXTERN void RCTFatal(NSError *error);
47+
48+
/**
49+
* The default error domain to be used for React errors.
50+
*/
51+
RCT_EXTERN NSString *const RCTErrorDomain;
52+
53+
/**
54+
* JS Stack trace provided as part of an NSError's userInfo
55+
*/
56+
RCT_EXTERN NSString *const RCTJSStackTraceKey;
57+
58+
/**
59+
* Raw JS Stack trace string provided as part of an NSError's userInfo
60+
*/
61+
RCT_EXTERN NSString *const RCTJSRawStackTraceKey;
62+
63+
/**
64+
* Name of fatal exceptions generated by RCTFatal
65+
*/
66+
RCT_EXTERN NSString *const RCTFatalExceptionName;
67+
68+
/**
69+
* A block signature to be used for custom assertion handling.
70+
*/
71+
typedef void (^RCTAssertFunction)(NSString *condition,
72+
NSString *fileName,
73+
NSNumber *lineNumber,
74+
NSString *function,
75+
NSString *message);
76+
77+
typedef void (^RCTFatalHandler)(NSError *error);
78+
79+
/**
80+
* Convenience macro for asserting that a parameter is non-nil/non-zero.
81+
*/
82+
#define RCTAssertParam(name) RCTAssert(name, @"'%s' is a required parameter", #name)
83+
84+
/**
85+
* Convenience macro for asserting that we're running on main queue.
86+
*/
87+
#define RCTAssertMainQueue() RCTAssert(RCTIsMainQueue(), \
88+
@"This function must be called on the main queue")
89+
90+
/**
91+
* Convenience macro for asserting that we're running off the main queue.
92+
*/
93+
#define RCTAssertNotMainQueue() RCTAssert(!RCTIsMainQueue(), \
94+
@"This function must not be called on the main queue")
95+
96+
/**
97+
* Deprecated, do not use
98+
*/
99+
#define RCTAssertMainThread() RCTAssertMainQueue()
100+
#define RCTAssertNotMainThread() RCTAssertNotMainQueue()
101+
102+
/**
103+
* These methods get and set the current assert function called by the RCTAssert
104+
* macros. You can use these to replace the standard behavior with custom assert
105+
* functionality.
106+
*/
107+
RCT_EXTERN void RCTSetAssertFunction(RCTAssertFunction assertFunction);
108+
RCT_EXTERN RCTAssertFunction RCTGetAssertFunction(void);
109+
110+
/**
111+
* This appends additional code to the existing assert function, without
112+
* replacing the existing functionality. Useful if you just want to forward
113+
* assert info to an extra service without changing the default behavior.
114+
*/
115+
RCT_EXTERN void RCTAddAssertFunction(RCTAssertFunction assertFunction);
116+
117+
/**
118+
* This method temporarily overrides the assert function while performing the
119+
* specified block. This is useful for testing purposes (to detect if a given
120+
* function asserts something) or to suppress or override assertions temporarily.
121+
*/
122+
RCT_EXTERN void RCTPerformBlockWithAssertFunction(void (^block)(void), RCTAssertFunction assertFunction);
123+
124+
/**
125+
These methods get and set the current fatal handler called by the RCTFatal method.
126+
*/
127+
RCT_EXTERN void RCTSetFatalHandler(RCTFatalHandler fatalHandler);
128+
RCT_EXTERN RCTFatalHandler RCTGetFatalHandler(void);
129+
130+
/**
131+
* Get the current thread's name (or the current queue, if in debug mode)
132+
*/
133+
RCT_EXTERN NSString *RCTCurrentThreadName(void);
134+
135+
/**
136+
* Helper to get generate exception message from NSError
137+
*/
138+
RCT_EXTERN NSString *RCTFormatError(NSString *message, NSArray<NSDictionary<NSString *, id> *> *stacktrace, NSUInteger maxMessageLength);
139+
140+
/**
141+
* Convenience macro to assert which thread is currently running (DEBUG mode only)
142+
*/
143+
#if DEBUG
144+
145+
#define RCTAssertThread(thread, format...) \
146+
_Pragma("clang diagnostic push") \
147+
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
148+
RCTAssert( \
149+
[(id)thread isKindOfClass:[NSString class]] ? \
150+
[RCTCurrentThreadName() isEqualToString:(NSString *)thread] : \
151+
[(id)thread isKindOfClass:[NSThread class]] ? \
152+
[NSThread currentThread] == (NSThread *)thread : \
153+
dispatch_get_current_queue() == (dispatch_queue_t)thread, \
154+
format); \
155+
_Pragma("clang diagnostic pop")
156+
157+
#else
158+
159+
#define RCTAssertThread(thread, format...) do { } while (0)
160+
161+
#endif

0 commit comments

Comments
 (0)