Updates from Fri Feb 27

- [react-packager] transformModulePath option is not actually required | Amjad Masad
- Implement TextInput.clearButtonMode added by D1875684 on OSS fork + example | Tadeu Zagallo
- [ReactNative] Use local CocoaPod config for ReactNative modules | Spencer Ahrens
- [ReactNative] Pull out some OSS modules into separate libs | Spencer Ahrens
- Enqueue events at 60fps + profiling helpers | Tadeu Zagallo
This commit is contained in:
Christopher Chedeau
2015-03-02 10:52:16 -08:00
parent 258c6b1b54
commit 0b09ed0667
218 changed files with 14048 additions and 278 deletions

View File

@@ -2,7 +2,7 @@
#import "AppDelegate.h"
#import "RCTRootView.h"
#import <ReactKit/RCTRootView.h>
@implementation AppDelegate

View File

@@ -11,19 +11,9 @@
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
8323482C1A77B59500B55238 /* libReactKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832348291A77B50100B55238 /* libReactKit.a */; };
8A63AAB95DEC603F81CC9914 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C80E9DAC4721961D27A5C59 /* libPods.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
832348281A77B50100B55238 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 834D32361A76971A00F38302 /* ReactKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = ReactKit;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
13B07F961A680F5B00A75B9A /* Movies.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Movies.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@@ -32,7 +22,17 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
834D32361A76971A00F38302 /* ReactKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactKit.xcodeproj; path = ../../ReactKit/ReactKit.xcodeproj; sourceTree = "<group>"; };
1C80E9DAC4721961D27A5C59 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
484633F6AF8FF4B8EB89512A /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
5845B59FBF51C4AAA4222097 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
587650991A9EA0C6008B8F17 /* libPods-RCTDataManager.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RCTDataManager.a"; path = "Pods/build/Debug-iphoneos/libPods-RCTDataManager.a"; sourceTree = "<group>"; };
5876509A1A9EA0C6008B8F17 /* libPods-RCTNetworkImage.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RCTNetworkImage.a"; path = "Pods/build/Debug-iphoneos/libPods-RCTNetworkImage.a"; sourceTree = "<group>"; };
5876509B1A9EA0C6008B8F17 /* libPods-RCTText.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RCTText.a"; path = "Pods/build/Debug-iphoneos/libPods-RCTText.a"; sourceTree = "<group>"; };
5876509C1A9EA0C6008B8F17 /* libPods-ReactKit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-ReactKit.a"; path = "Pods/build/Debug-iphoneos/libPods-ReactKit.a"; sourceTree = "<group>"; };
587650A11A9EA235008B8F17 /* libPods-RCTDataManager.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RCTDataManager.a"; path = "Pods/build/Debug-iphoneos/libPods-RCTDataManager.a"; sourceTree = "<group>"; };
587650A21A9EA235008B8F17 /* libPods-RCTNetworkImage.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RCTNetworkImage.a"; path = "Pods/build/Debug-iphoneos/libPods-RCTNetworkImage.a"; sourceTree = "<group>"; };
587650A31A9EA235008B8F17 /* libPods-RCTText.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-RCTText.a"; path = "Pods/build/Debug-iphoneos/libPods-RCTText.a"; sourceTree = "<group>"; };
587650A41A9EA235008B8F17 /* libPods-ReactKit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-ReactKit.a"; path = "Pods/build/Debug-iphoneos/libPods-ReactKit.a"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -40,13 +40,22 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8323482C1A77B59500B55238 /* libReactKit.a in Frameworks */,
8A63AAB95DEC603F81CC9914 /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0D1AC39A16823DF8332A23B7 /* Pods */ = {
isa = PBXGroup;
children = (
5845B59FBF51C4AAA4222097 /* Pods.debug.xcconfig */,
484633F6AF8FF4B8EB89512A /* Pods.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
13B07FAE1A68108700A75B9A /* Movies */ = {
isa = PBXGroup;
children = (
@@ -60,20 +69,13 @@
name = Movies;
sourceTree = "<group>";
};
832348241A77B50100B55238 /* Products */ = {
isa = PBXGroup;
children = (
832348291A77B50100B55238 /* libReactKit.a */,
);
name = Products;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
834D32361A76971A00F38302 /* ReactKit.xcodeproj */,
13B07FAE1A68108700A75B9A /* Movies */,
83CBBA001A601CBA00E9B192 /* Products */,
0D1AC39A16823DF8332A23B7 /* Pods */,
B748CE19D7EAD496E0205240 /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -85,6 +87,22 @@
name = Products;
sourceTree = "<group>";
};
B748CE19D7EAD496E0205240 /* Frameworks */ = {
isa = PBXGroup;
children = (
587650A11A9EA235008B8F17 /* libPods-RCTDataManager.a */,
587650A21A9EA235008B8F17 /* libPods-RCTNetworkImage.a */,
587650A31A9EA235008B8F17 /* libPods-RCTText.a */,
587650A41A9EA235008B8F17 /* libPods-ReactKit.a */,
587650991A9EA0C6008B8F17 /* libPods-RCTDataManager.a */,
5876509A1A9EA0C6008B8F17 /* libPods-RCTNetworkImage.a */,
5876509B1A9EA0C6008B8F17 /* libPods-RCTText.a */,
5876509C1A9EA0C6008B8F17 /* libPods-ReactKit.a */,
1C80E9DAC4721961D27A5C59 /* libPods.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -92,9 +110,11 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Movies" */;
buildPhases = (
480757813B188E9D7AD89A37 /* Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
602457BB761A1DB37CEBD865 /* Copy Pods Resources */,
);
buildRules = (
);
@@ -125,12 +145,6 @@
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 832348241A77B50100B55238 /* Products */;
ProjectRef = 834D32361A76971A00F38302 /* ReactKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* Movies */,
@@ -138,16 +152,6 @@
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
832348291A77B50100B55238 /* libReactKit.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReactKit.a;
remoteRef = 832348281A77B50100B55238 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
@@ -160,6 +164,39 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
480757813B188E9D7AD89A37 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
602457BB761A1DB37CEBD865 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -186,22 +223,44 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5845B59FBF51C4AAA4222097 /* Pods.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../ReactKit/**",
);
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Pods/build/Debug-iphoneos",
);
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = Movies;
};
name = Debug;
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 484633F6AF8FF4B8EB89512A /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../ReactKit/**",
);
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Pods/build/Debug-iphoneos",
);
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = Movies;
};
name = Release;

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Movies.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

6
Examples/Movies/Podfile Normal file
View File

@@ -0,0 +1,6 @@
source 'https://github.com/CocoaPods/Specs.git'
pod 'RCTDataManager', :path => '../../Libraries/Network'
pod 'RCTNetworkImage', :path => '../../Libraries/Image'
pod 'RCTText', :path => '../../Libraries/Text'
pod 'ReactKit', :path => '../../ReactKit'

View File

@@ -0,0 +1,32 @@
PODS:
- RCTDataManager (0.0.1):
- ReactKit (~> 0.0.1)
- RCTNetworkImage (0.0.1):
- ReactKit (~> 0.0.1)
- RCTText (0.0.1):
- ReactKit (~> 0.0.1)
- ReactKit (0.0.1)
DEPENDENCIES:
- RCTDataManager (from `../../Libraries/Network`)
- RCTNetworkImage (from `../../Libraries/Image`)
- RCTText (from `../../Libraries/Text`)
- ReactKit (from `../../ReactKit`)
EXTERNAL SOURCES:
RCTDataManager:
:path: ../../Libraries/Network
RCTNetworkImage:
:path: ../../Libraries/Image
RCTText:
:path: ../../Libraries/Text
ReactKit:
:path: ../../ReactKit
SPEC CHECKSUMS:
RCTDataManager: d38d2a6555886d68e8de623c4b97e2acdf01ed3e
RCTNetworkImage: 6d99735875916e098a65c68a54a72e67e24a402a
RCTText: 5c0cf4635241e8c02e8933853df03809d2dc8327
ReactKit: 65c02c1e95951c198e491d2a4c1972675d4af254
COCOAPODS: 0.35.0

View File

@@ -0,0 +1,10 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
#import "RCTBridgeModule.h"
@interface RCTDataManager : NSObject <RCTBridgeModule>
@end

View File

@@ -0,0 +1,22 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
typedef void (^RCTDataDownloadBlock)(NSData *data, NSError *error);
typedef void (^RCTImageDownloadBlock)(UIImage *image, NSError *error);
@interface RCTImageDownloader : NSObject
+ (instancetype)sharedInstance;
- (id)downloadDataForURL:(NSURL *)url
block:(RCTDataDownloadBlock)block;
- (id)downloadImageForURL:(NSURL *)url
size:(CGSize)size
scale:(CGFloat)scale
block:(RCTImageDownloadBlock)block;
- (void)cancelDownload:(id)downloadToken;
@end

View File

@@ -0,0 +1,32 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@class RCTImageDownloader;
@interface RCTNetworkImageView : UIView
- (instancetype)initWithFrame:(CGRect)frame imageDownloader:(RCTImageDownloader *)imageDownloader;
/**
* An image that will appear while the view is loading the image from the network,
* or when imageURL is nil. Defaults to nil.
*/
@property (nonatomic, strong) UIImage *defaultImage;
/**
* Specify a URL for an image. The image will be asynchronously loaded and displayed.
*/
@property (nonatomic, strong) NSURL *imageURL;
/**
* By default, changing imageURL will reset whatever existing image was present
* and revert to defaultImage while the new image loads. In certain obscure cases you
* may want to disable this behavior and instead keep displaying the previous image
* while the new one loads. In this case, pass NO for resetToDefaultImageWhileLoading.
* (If you set imageURL to nil, however, resetToDefaultImageWhileLoading is ignored;
* that will always reset to the default image.)
*/
- (void)setImageURL:(NSURL *)imageURL resetToDefaultImageWhileLoading:(BOOL)reset;
@end

View File

@@ -0,0 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTNetworkImageViewManager : RCTViewManager
@end

View File

@@ -0,0 +1,7 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTRawTextManager : RCTViewManager
@end

View File

@@ -0,0 +1,9 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTShadowView.h"
@interface RCTShadowRawText : RCTShadowView
@property (nonatomic, copy) NSString *text;
@end

View File

@@ -0,0 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTShadowView.h"
extern NSString *const RCTIsHighlightedAttributeName;
extern NSString *const RCTReactTagAttributeName;
@interface RCTShadowText : RCTShadowView
@property (nonatomic, assign) NSWritingDirection writingDirection;
@property (nonatomic, strong) UIColor *textBackgroundColor;
@property (nonatomic, strong) UIColor *color;
@property (nonatomic, strong) UIFont *font;
@property (nonatomic, copy) NSString *fontFamily;
@property (nonatomic, assign) CGFloat fontSize;
@property (nonatomic, copy) NSString *fontWeight;
@property (nonatomic, assign) BOOL isHighlighted;
@property (nonatomic, assign) CGFloat lineHeight;
@property (nonatomic, assign) NSInteger maxNumberOfLines;
@property (nonatomic, assign) CGSize shadowOffset;
@property (nonatomic, assign) NSTextAlignment textAlign;
@property (nonatomic, assign) NSLineBreakMode truncationMode;
- (NSAttributedString *)attributedString;
@end

View File

@@ -0,0 +1,13 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@interface RCTText : UIView
@property (nonatomic, copy) NSAttributedString *attributedText;
@property (nonatomic, assign) NSLineBreakMode lineBreakMode;
@property (nonatomic, assign) NSUInteger numberOfLines;
- (NSNumber *)reactTagAtPoint:(CGPoint)point;
@end

View File

@@ -0,0 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTTextManager : RCTViewManager
@end

View File

@@ -0,0 +1,148 @@
/**
* @generated SignedSource<<58298c7a8815a8675e970b0347dedfed>>
*
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !! This file is a check-in from github! !!
* !! !!
* !! You should not modify this file directly. Instead: !!
* !! 1) Go to https://github.com/facebook/css-layout !!
* !! 2) Make a pull request and get it merged !!
* !! 3) Execute ./import.sh to pull in the latest version !!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#ifndef __LAYOUT_H
#define __LAYOUT_H
#include <math.h>
#include <stdbool.h>
#define CSS_UNDEFINED NAN
typedef enum {
CSS_FLEX_DIRECTION_COLUMN = 0,
CSS_FLEX_DIRECTION_ROW
} css_flex_direction_t;
typedef enum {
CSS_JUSTIFY_FLEX_START = 0,
CSS_JUSTIFY_CENTER,
CSS_JUSTIFY_FLEX_END,
CSS_JUSTIFY_SPACE_BETWEEN,
CSS_JUSTIFY_SPACE_AROUND
} css_justify_t;
// Note: auto is only a valid value for alignSelf. It is NOT a valid value for
// alignItems.
typedef enum {
CSS_ALIGN_AUTO = 0,
CSS_ALIGN_FLEX_START,
CSS_ALIGN_CENTER,
CSS_ALIGN_FLEX_END,
CSS_ALIGN_STRETCH
} css_align_t;
typedef enum {
CSS_POSITION_RELATIVE = 0,
CSS_POSITION_ABSOLUTE
} css_position_type_t;
typedef enum {
CSS_NOWRAP = 0,
CSS_WRAP
} css_wrap_type_t;
// Note: left and top are shared between position[2] and position[4], so
// they have to be before right and bottom.
typedef enum {
CSS_LEFT = 0,
CSS_TOP,
CSS_RIGHT,
CSS_BOTTOM,
CSS_POSITION_COUNT
} css_position_t;
typedef enum {
CSS_WIDTH = 0,
CSS_HEIGHT
} css_dimension_t;
typedef struct {
float position[2];
float dimensions[2];
// Instead of recomputing the entire layout every single time, we
// cache some information to break early when nothing changed
bool should_update;
float last_requested_dimensions[2];
float last_parent_max_width;
float last_dimensions[2];
float last_position[2];
} css_layout_t;
typedef struct {
float dimensions[2];
} css_dim_t;
typedef struct {
css_flex_direction_t flex_direction;
css_justify_t justify_content;
css_align_t align_items;
css_align_t align_self;
css_position_type_t position_type;
css_wrap_type_t flex_wrap;
float flex;
float margin[4];
float position[4];
/**
* You should skip all the rules that contain negative values for the
* following attributes. For example:
* {padding: 10, paddingLeft: -5}
* should output:
* {left: 10 ...}
* the following two are incorrect:
* {left: -5 ...}
* {left: 0 ...}
*/
float padding[4];
float border[4];
float dimensions[2];
} css_style_t;
typedef struct css_node {
css_style_t style;
css_layout_t layout;
int children_count;
css_dim_t (*measure)(void *context, float width);
void (*print)(void *context);
struct css_node* (*get_child)(void *context, int i);
bool (*is_dirty)(void *context);
void *context;
} css_node_t;
// Lifecycle of nodes and children
css_node_t *new_css_node(void);
void init_css_node(css_node_t *node);
void free_css_node(css_node_t *node);
// Print utilities
typedef enum {
CSS_PRINT_LAYOUT = 1,
CSS_PRINT_STYLE = 2,
CSS_PRINT_CHILDREN = 4,
} css_print_options_t;
void print_css_node(css_node_t *node, css_print_options_t options);
// Function that computes the layout!
void layoutNode(css_node_t *node, float maxWidth);
bool isUndefined(float value);
#endif

View File

@@ -0,0 +1,9 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
@interface RCTAlertManager : NSObject <RCTBridgeModule>
@end

View File

@@ -0,0 +1,11 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, RCTAnimationType) {
RCTAnimationTypeSpring = 0,
RCTAnimationTypeLinear,
RCTAnimationTypeEaseIn,
RCTAnimationTypeEaseOut,
RCTAnimationTypeEaseInEaseOut,
};

View File

@@ -0,0 +1,36 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
#define RCTErrorDomain @"RCTErrorDomain"
#define RCTAssert(condition, message, ...) _RCTAssert(condition, message, ##__VA_ARGS__)
#define RCTCAssert(condition, message, ...) _RCTCAssert(condition, message, ##__VA_ARGS__)
typedef void (^RCTAssertFunction)(BOOL condition, NSString *message, ...);
extern RCTAssertFunction RCTInjectedAssertFunction;
extern RCTAssertFunction RCTInjectedCAssertFunction;
void RCTInjectAssertFunctions(RCTAssertFunction assertFunction, RCTAssertFunction cAssertFunction);
#define _RCTAssert(condition, message, ...) \
do { \
if (RCTInjectedAssertFunction) { \
RCTInjectedAssertFunction(condition, message, ##__VA_ARGS__); \
} else { \
NSAssert(condition, message, ##__VA_ARGS__); \
} \
} while (false)
#define _RCTCAssert(condition, message, ...) \
do { \
if (RCTInjectedCAssertFunction) { \
RCTInjectedCAssertFunction(condition, message, ##__VA_ARGS__); \
} else { \
NSCAssert(condition, message, ##__VA_ARGS__); \
} \
} while (false)
#define RCTAssertMainThread() RCTAssert([NSThread isMainThread], @"This method must be called on the main thread");
#define RCTCAssertMainThread() RCTCAssert([NSThread isMainThread], @"This function must be called on the main thread");

View File

@@ -0,0 +1,13 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
/**
* Defines a View that wants to support auto insets adjustment
*/
@protocol RCTAutoInsetsProtocol
@property (nonatomic, assign, readwrite) UIEdgeInsets contentInset;
@property (nonatomic, assign, readwrite) BOOL automaticallyAdjustContentInsets;
@end

View File

@@ -0,0 +1,107 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTBridgeModule.h"
#import "RCTInvalidating.h"
#import "RCTJavaScriptExecutor.h"
@class RCTBridge;
@class RCTEventDispatcher;
@class RCTRootView;
/**
* Utilities for constructing common response objects. When sending a
* systemError back to JS, it's important to describe whether or not it was a
* system error, or API usage error. System errors should never happen and are
* therefore logged using `RCTLogError()`. API usage errors are expected if the
* API is misused and will therefore not be logged using `RCTLogError()`. The JS
* application code is expected to handle them. Regardless of type, each error
* should be logged at most once.
*/
static inline NSDictionary *RCTSystemErrorObject(NSString *msg)
{
return @{@"systemError": msg ?: @""};
}
static inline NSDictionary *RCTAPIErrorObject(NSString *msg)
{
return @{@"apiError": msg ?: @""};
}
/**
* This block can be used to instantiate modules that require additional
* init parameters, or additional configuration prior to being used.
*/
typedef NSArray *(^RCTBridgeModuleProviderBlock)(RCTBridge *bridge);
/**
* Async batched bridge used to communicate with the JavaScript application.
*/
@interface RCTBridge : NSObject <RCTInvalidating>
/**
* The designated initializer. This creates a new bridge on top of the specified
* executor. The bridge should then be used for all subsequent communication
* with the JavaScript code running in the executor. Modules will be automatically
* instantiated using the default contructor, but you can optionally pass in a
* module provider block to manually instantiate modules that require additional
* init parameters or configuration.
*/
- (instancetype)initWithJavaScriptExecutor:(id<RCTJavaScriptExecutor>)javaScriptExecutor
moduleProvider:(RCTBridgeModuleProviderBlock)block NS_DESIGNATED_INITIALIZER;
/**
* This method is used to call functions in the JavaScript application context.
* It is primarily intended for use by modules that require two-way communication
* with the JavaScript code.
*/
- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args;
/**
* This method is used to execute a new application script. It is called
* internally whenever a JS application bundle is loaded/reloaded, but should
* probably not be used at any other time.
*/
- (void)enqueueApplicationScript:(NSString *)script url:(NSURL *)url onComplete:(RCTJavaScriptCompleteBlock)onComplete;
/**
* The event dispatcher is a wrapper around -enqueueJSCall:args: that provides a
* higher-level interface for sending UI events such as touches and text input.
*/
@property (nonatomic, readonly) RCTEventDispatcher *eventDispatcher;
/**
* A dictionary of all registered RCTBridgeModule instances, keyed by moduleName.
*/
@property (nonatomic, copy, readonly) NSDictionary *modules;
/**
* The shadow queue is used to execute callbacks from the JavaScript code. All
* native hooks (e.g. exported module methods) will be executed on the shadow
* queue.
*/
@property (nonatomic, readonly) dispatch_queue_t shadowQueue;
// For use in implementing delegates, which may need to queue responses.
- (RCTResponseSenderBlock)createResponseSenderBlock:(NSInteger)callbackID;
/**
* Register a root view with the bridge. Theorectically, a single bridge can
* support multiple root views, however this feature is not currently exposed
* and may eventually be removed.
*/
- (void)registerRootView:(RCTRootView *)rootView;
/**
* Global logging function that will print to both xcode and JS debugger consoles.
*
* NOTE: Use via RCTLog* macros defined in RCTLog.h
* TODO (#5906496): should log function be exposed here, or could it be a module?
*/
+ (void)log:(NSArray *)objects level:(NSString *)level;
/**
* Method to check that a valid executor exists with which to log
*/
+ (BOOL)hasValidJSExecutor;
@end

View File

@@ -0,0 +1,64 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
#import "RCTJSMethodRegistrar.h"
@class RCTBridge;
/**
* The type of a block that is capable of sending a response to a bridged
* operation. Use this for returning callback methods to JS.
*/
typedef void (^RCTResponseSenderBlock)(NSArray *response);
/**
* Provides the interface needed to register a bridge module.
*/
@protocol RCTBridgeModule <RCTJSMethodRegistrar>
@optional
/**
* Optional initializer for modules that require access
* to bridge features, such as sending events or making JS calls
*/
- (instancetype)initWithBridge:(RCTBridge *)bridge;
/**
* The module name exposed to JS. If omitted, this will be inferred
* automatically by using the native module's class name.
*/
+ (NSString *)moduleName;
/**
* Place this macro inside the method body of any method you want to expose
* to JS. The optional js_name argument will be used as the JS method name
* (the method will be namespaced to the module name, as specified above).
* If omitted, the JS method name will match the first part of the Objective-C
* method selector name (up to the first colon).
*/
#define RCT_EXPORT(js_name) __attribute__((used, section("__DATA,RCTExport" \
))) static const char *__rct_export_entry__[] = { __func__, #js_name }
/**
* Injects constants into JS. These constants are made accessible via
* NativeModules.moduleName.X. Note that this method is not inherited when you
* subclass a module, and you should not call [super constantsToExport] when
* implementing it.
*/
+ (NSDictionary *)constantsToExport;
/**
* Some "constants" are not really constant, and need to be re-generated
* each time the bridge module is created. Support for this feature is
* deprecated and may be going away or changing, but for now you can use
* the -constantsToExport instance method to register these "pseudo-constants".
*/
- (NSDictionary *)constantsToExport;
/**
* Notifies the module that a batch of JS method invocations has just completed.
*/
- (void)batchDidComplete;
@end

View File

@@ -0,0 +1,22 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
@interface RCTCache : NSObject
- (instancetype)init; // name = @"default"
- (instancetype)initWithName:(NSString *)name;
@property (nonatomic, assign) NSUInteger maximumDiskSize; // in bytes
#pragma mark - Retrieval
- (BOOL)hasDataForKey:(NSString *)key;
- (void)fetchDataForKey:(NSString *)key completionHandler:(void (^)(NSData *data))completionHandler;
#pragma mark - Insertion
- (void)setData:(NSData *)data forKey:(NSString *)key;
- (void)removeAllData;
@end

View File

@@ -0,0 +1,21 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <JavaScriptCore/JavaScriptCore.h>
#import "RCTJavaScriptExecutor.h"
// TODO (#5906496): Might RCTJSCoreExecutor be a better name for this?
/**
* Uses a JavaScriptCore context as the execution engine.
*/
@interface RCTContextExecutor : NSObject <RCTJavaScriptExecutor>
/**
* Configures the executor to run JavaScript on a custom performer.
* You probably don't want to use this; use -init instead.
*/
- (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread
globalContextRef:(JSGlobalContextRef)context;
@end

View File

@@ -0,0 +1,85 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#import "Layout.h"
#import "RCTPointerEvents.h"
#import "RCTAnimationType.h"
/**
* This class provides a collection of conversion functions for mapping
* JSON objects to native types and classes. These are useful when writing
* custom RCTViewManager setter methods.
*/
@interface RCTConvert : NSObject
+ (BOOL)BOOL:(id)json;
+ (double)double:(id)json;
+ (float)float:(id)json;
+ (int)int:(id)json;
+ (NSString *)NSString:(id)json;
+ (NSNumber *)NSNumber:(id)json;
+ (NSInteger)NSInteger:(id)json;
+ (NSUInteger)NSUInteger:(id)json;
+ (NSURL *)NSURL:(id)json;
+ (NSURLRequest *)NSURLRequest:(id)json;
+ (NSDate *)NSDate:(id)json;
+ (NSTimeZone *)NSTimeZone:(id)json;
+ (NSTimeInterval)NSTimeInterval:(id)json;
+ (NSTextAlignment)NSTextAlignment:(id)json;
+ (NSWritingDirection)NSWritingDirection:(id)json;
+ (UITextAutocapitalizationType)UITextAutocapitalizationType:(id)json;
+ (UIKeyboardType)UIKeyboardType:(id)json;
+ (CGFloat)CGFloat:(id)json;
+ (CGPoint)CGPoint:(id)json;
+ (CGSize)CGSize:(id)json;
+ (CGRect)CGRect:(id)json;
+ (UIEdgeInsets)UIEdgeInsets:(id)json;
+ (CATransform3D)CATransform3D:(id)json;
+ (CGAffineTransform)CGAffineTransform:(id)json;
+ (UIColor *)UIColor:(id)json;
+ (CGColorRef)CGColor:(id)json;
+ (CAKeyframeAnimation *)GIF:(id)json;
+ (UIImage *)UIImage:(id)json;
+ (CGImageRef)CGImage:(id)json;
+ (UIFont *)UIFont:(UIFont *)font withSize:(id)json;
+ (UIFont *)UIFont:(UIFont *)font withWeight:(id)json;
+ (UIFont *)UIFont:(UIFont *)font withFamily:(id)json;
+ (UIFont *)UIFont:(UIFont *)font withFamily:(id)json size:(id)json weight:(id)json;
+ (BOOL)css_overflow:(id)json;
+ (css_flex_direction_t)css_flex_direction_t:(id)json;
+ (css_justify_t)css_justify_t:(id)json;
+ (css_align_t)css_align_t:(id)json;
+ (css_position_type_t)css_position_type_t:(id)json;
+ (css_wrap_type_t)css_wrap_type_t:(id)json;
+ (RCTPointerEvents)RCTPointerEvents:(id)json;
+ (RCTAnimationType)RCTAnimationType:(id)json;
@end
/**
* This function will attempt to set a property using a json value by first
* inferring the correct type from all available information, and then
* applying an appropriate conversion method. If the property does not
* exist, or the type cannot be inferred, the function will return NO.
*/
BOOL RCTSetProperty(id target, NSString *keypath, id json);
/**
* This function attempts to copy a property from the source object to the
* destination object using KVC. If the property does not exist, or cannot
* be set, it will do nothing and return NO.
*/
BOOL RCTCopyProperty(id target, id source, NSString *keypath);

View File

@@ -0,0 +1,66 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@class RCTBridge;
typedef NS_ENUM(NSInteger, RCTTextEventType) {
RCTTextEventTypeFocus,
RCTTextEventTypeBlur,
RCTTextEventTypeChange,
RCTTextEventTypeSubmit,
RCTTextEventTypeEnd
};
typedef NS_ENUM(NSInteger, RCTScrollEventType) {
RCTScrollEventTypeStart,
RCTScrollEventTypeMove,
RCTScrollEventTypeEnd,
RCTScrollEventTypeStartDeceleration,
RCTScrollEventTypeEndDeceleration,
RCTScrollEventTypeEndAnimation,
};
/**
* This class wraps the -[RCTBridge enqueueJSCall:args:] method, and
* provides some convenience methods for generating event calls.
*/
@interface RCTEventDispatcher : NSObject
- (instancetype)initWithBridge:(RCTBridge *)bridge;
/**
* Send an application-specific event that does not relate to a specific
* view, e.g. a navigation or data update notification.
*/
- (void)sendAppEventWithName:(NSString *)name body:(id)body;
/**
* Send a device or iOS event that does not relate to a specific view,
* e.g.rotation, location, keyboard show/hide, background/awake, etc.
*/
- (void)sendDeviceEventWithName:(NSString *)name body:(id)body;
/**
* Send a user input event. The body dictionary must contain a "target"
* parameter, representing the react tag of the view sending the event
*/
- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body;
/**
* Send a text input/focus event.
*/
- (void)sendTextEventWithType:(RCTTextEventType)type
reactTag:(NSNumber *)reactTag
text:(NSString *)text;
/**
* Send a scroll event.
* (You can send a fake scroll event by passing nil for scrollView).
*/
- (void)sendScrollEventWithType:(RCTScrollEventType)type
reactTag:(NSNumber *)reactTag
scrollView:(UIScrollView *)scrollView
userData:(NSDictionary *)userData;
@end

View File

@@ -0,0 +1,9 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
#import "RCTBridgeModule.h"
@interface RCTExceptionsManager : NSObject <RCTBridgeModule>
@end

View File

@@ -0,0 +1,16 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
// TODO (#5906496): is there a reason for this protocol? It seems to be
// used in a number of places where it isn't really required - only the
// RCTBridge actually ever calls casts to it - in all other
// cases it is simply a way of adding some method definitions to classes
@protocol RCTInvalidating <NSObject>
@property (nonatomic, assign, readonly, getter = isValid) BOOL valid;
- (void)invalidate;
@end

View File

@@ -0,0 +1,24 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
@class RCTBridge;
/**
* Provides an interface to register JS methods to be called via the bridge.
*/
@protocol RCTJSMethodRegistrar <NSObject>
@optional
/**
* An array of JavaScript methods that the class will call via the
* -[RCTBridge enqueueJSCall:args:] method. Each method should be specified
* as a string of the form "JSModuleName.jsMethodName". Attempting to call a
* method that has not been registered will result in an error. If a method
* has already been registered by another class, it is not necessary to
* register it again, but it is good practice. Registering the same method
* more than once is silently ignored and will not result in an error.
*/
+ (NSArray *)JSMethods;
@end

View File

@@ -0,0 +1,35 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <JavaScriptCore/JavaScriptCore.h>
#import "RCTInvalidating.h"
typedef void (^RCTJavaScriptCompleteBlock)(NSError *error);
typedef void (^RCTJavaScriptCallback)(id objcValue, NSError *error);
/**
* Abstracts away a JavaScript execution context - we may be running code in a
* web view (for debugging purposes), or may be running code in a `JSContext`.
*/
@protocol RCTJavaScriptExecutor <RCTInvalidating>
/**
* Executes given method with arguments on JS thread and calls the given callback
* with JSValue and JSContext as a result of the JS module call.
*/
- (void)executeJSCall:(NSString *)name
method:(NSString *)method
arguments:(NSArray *)arguments
callback:(RCTJavaScriptCallback)onComplete;
/**
* Runs an application script, and notifies of the script load being complete via `onComplete`.
*/
- (void)executeApplicationScript:(NSString *)script
sourceURL:(NSURL *)url
onComplete:(RCTJavaScriptCompleteBlock)onComplete;
- (void)injectJSONText:(NSString *)script
asGlobalObjectNamed:(NSString *)objectName
callback:(RCTJavaScriptCompleteBlock)onComplete;
@end

View File

@@ -0,0 +1,28 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@interface RCTKeyCommands : NSObject
+ (instancetype)sharedInstance;
/**
* Register a keyboard command.
*/
- (void)registerKeyCommandWithInput:(NSString *)input
modifierFlags:(UIKeyModifierFlags)flags
action:(void (^)(UIKeyCommand *command))block;
/**
* Unregister a keyboard command.
*/
- (void)unregisterKeyCommandWithInput:(NSString *)input
modifierFlags:(UIKeyModifierFlags)flags;
/**
* Check if a command is registered.
*/
- (BOOL)isKeyCommandRegisteredForInput:(NSString *)input
modifierFlags:(UIKeyModifierFlags)flags;
@end

View File

@@ -0,0 +1,69 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTAssert.h"
#import "RCTRedBox.h"
#define RCTLOG_INFO 1
#define RCTLOG_WARN 2
#define RCTLOG_ERROR 3
#define RCTLOG_MUSTFIX 4
// If set to e.g. `RCTLOG_ERROR`, will assert after logging the first error.
#if DEBUG
#define RCTLOG_FATAL_LEVEL RCTLOG_MUSTFIX
#define RCTLOG_REDBOX_LEVEL RCTLOG_ERROR
#else
#define RCTLOG_FATAL_LEVEL (RCTLOG_MUSTFIX + 1)
#define RCTLOG_REDBOX_LEVEL (RCTLOG_MUSTFIX + 1)
#endif
// If defined, only log messages that match this regex will fatal
#define RCTLOG_FATAL_REGEX nil
#define _RCTLog(__RCTLog__level, ...) do { \
NSString *__RCTLog__levelStr; \
switch(__RCTLog__level) { \
case RCTLOG_INFO: __RCTLog__levelStr = @"info"; break; \
case RCTLOG_WARN: __RCTLog__levelStr = @"warn"; break; \
case RCTLOG_ERROR: __RCTLog__levelStr = @"error"; break; \
case RCTLOG_MUSTFIX: __RCTLog__levelStr = @"mustfix"; break; \
} \
NSString *__RCTLog__msg = _RCTLogObjects(RCTLogFormat(__VA_ARGS__), __RCTLog__levelStr); \
if (__RCTLog__level >= RCTLOG_FATAL_LEVEL) { \
BOOL __RCTLog__fail = YES; \
if (RCTLOG_FATAL_REGEX) { \
NSError *__RCTLog__e; \
NSRegularExpression *__RCTLog__regex = [NSRegularExpression regularExpressionWithPattern:RCTLOG_FATAL_REGEX options:0 error:&__RCTLog__e]; \
__RCTLog__fail = [__RCTLog__regex numberOfMatchesInString:__RCTLog__msg options:0 range:NSMakeRange(0, [__RCTLog__msg length])] > 0; \
} \
RCTCAssert(!__RCTLog__fail, @"RCTLOG_FATAL_LEVEL %@: %@", __RCTLog__levelStr, __RCTLog__msg); \
} \
if (__RCTLog__level >= RCTLOG_REDBOX_LEVEL) { \
RCTRedBox *__RCTLog__redBox = [RCTRedBox sharedInstance]; \
[__RCTLog__redBox showErrorMessage:__RCTLog__msg]; \
} \
} while (0)
#define RCTLog(...) _RCTLog(RCTLOG_INFO, __VA_ARGS__)
#define RCTLogInfo(...) _RCTLog(RCTLOG_INFO, __VA_ARGS__)
#define RCTLogWarn(...) _RCTLog(RCTLOG_WARN, __VA_ARGS__)
#define RCTLogError(...) _RCTLog(RCTLOG_ERROR, __VA_ARGS__)
#define RCTLogMustFix(...) _RCTLog(RCTLOG_MUSTFIX, __VA_ARGS__)
#define RCTLogFormat(...) _RCTLogFormat(__FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
#define RCTLogFormatString(...) _RCTLogFormatString(__FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
#ifdef __cplusplus
extern "C" {
#endif
NSString *_RCTLogObjects(NSArray *objects, NSString *level);
NSArray *_RCTLogFormat(const char *file, int lineNumber, const char *funcName, NSString *format, ...) NS_FORMAT_FUNCTION(4,5);
NSString *_RCTLogFormatString(const char *file, int lineNumber, const char *funcName, NSString *format, ...) NS_FORMAT_FUNCTION(4,5);
#ifdef __cplusplus
}
#endif
typedef void (^RCTLogFunction)(NSString *format, NSString *str);
void RCTInjectLogFunction(RCTLogFunction func);

View File

@@ -0,0 +1,14 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@interface RCTNavItem : UIView
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *rightButtonTitle;
@property (nonatomic, copy) NSString *backButtonTitle;
@property (nonatomic, copy) UIColor *tintColor;
@property (nonatomic, copy) UIColor *barTintColor;
@property (nonatomic, copy) UIColor *titleTextColor;
@end

View File

@@ -0,0 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTNavItemManager : RCTViewManager
@end

View File

@@ -0,0 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTInvalidating.h"
@class RCTEventDispatcher;
@interface RCTNavigator : UIView <RCTInvalidating>
@property (nonatomic, strong) UIView *reactNavSuperviewLink;
@property (nonatomic, assign) NSInteger requestedTopOfStack;
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher;
/**
* Schedules a JavaScript navigation and prevents `UIKit` from navigating until
* JavaScript has sent its scheduled navigation.
*
* @returns Whether or not a JavaScript driven navigation could be
* scheduled/reserved. If returning `NO`, JavaScript should usually just do
* nothing at all.
*/
- (BOOL)requestSchedulingJavaScriptNavigation;
@end

View File

@@ -0,0 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTNavigatorManager : RCTViewManager
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, RCTPointerEvents) {
RCTPointerEventsUnspecified = 0, // Default
RCTPointerEventsNone,
RCTPointerEventsBoxNone,
RCTPointerEventsBoxOnly,
};

View File

@@ -0,0 +1,16 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@interface RCTRedBox : NSObject
+ (instancetype)sharedInstance;
- (void)showErrorMessage:(NSString *)message;
- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details;
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack;
- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack;
- (void)dismiss;
@end

View File

@@ -0,0 +1,44 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@interface RCTRootView : UIView
/**
* The URL of the bundled application script (required).
* Setting this will clear the view contents, and trigger
* an asynchronous load/download and execution of the script.
*/
@property (nonatomic, strong) NSURL *scriptURL;
/**
* The name of the JavaScript module to execute within the
* specified scriptURL (required). Setting this will not have
* any immediate effect, but it must be done prior to loading
* the script.
*/
@property (nonatomic, copy) NSString *moduleName;
/**
* The default properties to apply to the view when the script bundle
* is first loaded. Defaults to nil/empty.
*/
@property (nonatomic, copy) NSDictionary *initialProperties;
/**
* The class of the RCTJavaScriptExecutor to use with this view.
* If not specified, it will default to using RCTContextExecutor.
* Changes will take effect next time the bundle is reloaded.
*/
@property (nonatomic, strong) Class executorClass;
/**
* Reload this root view, or all root views, respectively.
*/
- (void)reload;
+ (void)reloadAll;
- (void)startOrResetInteractionTiming;
- (NSDictionary *)endAndResetInteractionTiming;
@end

View File

@@ -0,0 +1,37 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIScrollView.h>
#import "RCTAutoInsetsProtocol.h"
#import "RCTScrollableProtocol.h"
#import "RCTView.h"
@protocol UIScrollViewDelegate;
@class RCTEventDispatcher;
@interface RCTScrollView : RCTView <UIScrollViewDelegate, RCTScrollableProtocol, RCTAutoInsetsProtocol>
/**
* If the `contentSize` is not provided, then the `contentSize` will
* automatically be determined by the size of the `RKScrollView` subview.
*
* The `RCTScrollView` may have at most one single subview. This will ensure
* that the scroll view's `contentSize` will be efficiently set to the size of
* the single subview's frame. That frame size will be determined somewhat
* efficiently since it will have already been computed by the off-main-thread
* layout system.
*/
@property (nonatomic, readonly) UIScrollView *scrollView;
@property (nonatomic, readonly) UIView *contentView;
@property (nonatomic, assign) CGSize contentSize;
@property (nonatomic, assign) UIEdgeInsets contentInset;
@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
@property (nonatomic, assign) NSUInteger throttleScrollCallbackMS;
@property (nonatomic, assign) BOOL centerContent;
@property (nonatomic, copy) NSArray *stickyHeaderIndices;
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher;
@end

View File

@@ -0,0 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTScrollViewManager : RCTViewManager
@end

View File

@@ -0,0 +1,18 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
/**
* Contains any methods related to scrolling. Any `RCTView` that has scrolling
* features should implement these methods.
*/
@protocol RCTScrollableProtocol
@property (nonatomic, readwrite, weak) NSObject<UIScrollViewDelegate> *nativeMainScrollDelegate;
@property (nonatomic, readonly) CGSize contentSize;
- (void)scrollToOffset:(CGPoint)offset;
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated;
- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated;
@end

View File

@@ -0,0 +1,159 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "Layout.h"
#import "RCTViewNodeProtocol.h"
@class RCTSparseArray;
// TODO: amalgamate these enums?
typedef NS_ENUM(NSUInteger, RCTLayoutLifecycle) {
RCTLayoutLifecycleUninitialized = 0,
RCTLayoutLifecycleComputed,
RCTLayoutLifecycleDirtied,
};
// TODO: is this still needed?
typedef NS_ENUM(NSUInteger, RCTPropagationLifecycle) {
RCTPropagationLifecycleUninitialized = 0,
RCTPropagationLifecycleComputed,
RCTPropagationLifecycleDirtied,
};
// TODO: move this to text node?
typedef NS_ENUM(NSUInteger, RCTTextLifecycle) {
RCTTextLifecycleUninitialized = 0,
RCTTextLifecycleComputed,
RCTTextLifecycleDirtied,
};
// TODO: is this redundact now?
typedef void (^RCTApplierBlock)(RCTSparseArray *);
/**
* ShadowView tree mirrors RCT view tree. Every node is highly stateful.
* 1. A node is in one of three lifecycles: uninitialized, computed, dirtied.
* 1. RCTBridge may call any of the padding/margin/width/height/top/left setters. A setter would dirty
* the node and all of its ancestors.
* 2. At the end of each Bridge transaction, we call collectUpdatedFrames:widthConstraint:heightConstraint
* at the root node to recursively lay out the entire hierarchy.
* 3. If a node is "computed" and the constraint passed from above is identical to the constraint used to
* perform the last computation, we skip laying out the subtree entirely.
*/
@interface RCTShadowView : NSObject <RCTViewNodeProtocol>
@property (nonatomic, weak, readonly) RCTShadowView *superview;
@property (nonatomic, assign, readonly) css_node_t *cssNode;
@property (nonatomic, copy) NSString *moduleName;
@property (nonatomic, assign) BOOL isBGColorExplicitlySet; // Used to propogate to children
@property (nonatomic, strong) UIColor *backgroundColor; // Used to propogate to children
@property (nonatomic, assign) RCTLayoutLifecycle layoutLifecycle;
/**
* isNewView - Used to track the first time the view is introduced into the hierarchy. It is initialized YES, then is
* set to NO in RCTUIManager after the layout pass is done and all frames have been extracted to be applied to the
* corresponding UIViews.
*/
@property (nonatomic, assign, getter=isNewView) BOOL newView;
/**
* Is this the shadowView for an RCTRootView
*/
@property (nonatomic, assign, getter=isReactRootView) BOOL reactRootView;
/**
* Position and dimensions.
* Defaults to { 0, 0, NAN, NAN }.
*/
@property (nonatomic, assign) CGFloat top;
@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGRect frame;
- (void)setTopLeft:(CGPoint)topLeft;
- (void)setSize:(CGSize)size;
/**
* Border. Defaults to { 0, 0, 0, 0 }.
*/
@property (nonatomic, assign) CGFloat borderTop;
@property (nonatomic, assign) CGFloat borderLeft;
@property (nonatomic, assign) CGFloat borderWidth;
@property (nonatomic, assign) CGFloat borderHeight;
- (void)setBorderWidth:(CGFloat)value;
/**
* Margin. Defaults to { 0, 0, 0, 0 }.
*/
@property (nonatomic, assign) CGFloat marginTop;
@property (nonatomic, assign) CGFloat marginLeft;
@property (nonatomic, assign) CGFloat marginBottom;
@property (nonatomic, assign) CGFloat marginRight;
- (void)setMargin:(CGFloat)margin;
- (void)setMarginVertical:(CGFloat)margin;
- (void)setMarginHorizontal:(CGFloat)margin;
/**
* Padding. Defaults to { 0, 0, 0, 0 }.
*/
@property (nonatomic, assign) CGFloat paddingTop;
@property (nonatomic, assign) CGFloat paddingLeft;
@property (nonatomic, assign) CGFloat paddingBottom;
@property (nonatomic, assign) CGFloat paddingRight;
- (void)setPadding:(CGFloat)padding;
- (void)setPaddingVertical:(CGFloat)padding;
- (void)setPaddingHorizontal:(CGFloat)padding;
- (UIEdgeInsets)paddingAsInsets;
/**
* Flexbox properties. All zero/disabled by default
*/
@property (nonatomic, assign) css_flex_direction_t flexDirection;
@property (nonatomic, assign) css_justify_t justifyContent;
@property (nonatomic, assign) css_align_t alignSelf;
@property (nonatomic, assign) css_align_t alignItems;
@property (nonatomic, assign) css_position_type_t positionType;
@property (nonatomic, assign) css_wrap_type_t flexWrap;
@property (nonatomic, assign) CGFloat flex;
- (void)collectUpdatedProperties:(NSMutableSet *)viewsWithNewProperties parentProperties:(NSDictionary *)parentProperties;
- (void)collectRootUpdatedFrames:(NSMutableSet *)viewsWithNewFrame parentConstraint:(CGSize)parentConstraint;
- (void)fillCSSNode:(css_node_t *)node;
// The following are implementation details exposed to subclasses. Do not call them directly
- (void)dirtyLayout;
- (BOOL)isLayoutDirty;
// TODO: is this still needed?
- (void)dirtyPropagation;
- (BOOL)isPropagationDirty;
// TODO: move this to text node?
- (void)dirtyText;
- (BOOL)isTextDirty;
- (void)setTextComputed;
/**
* Triggers a recalculation of the shadow view's layout.
*/
- (void)updateShadowViewLayout;
/**
* Computes the recursive offset, meaning the sum of all descendant offsets -
* this is the sum of all positions inset from parents. This is not merely the
* sum of `top`/`left`s, as this function uses the *actual* positions of
* children, not the style specified positions - it computes this based on the
* resulting layout. It does not yet compensate for native scroll view insets or
* transforms or anchor points. Returns an array containing the `x, y, width,
* height` of the shadow view relative to the ancestor, or `nil` if the `view`
* is not a descendent of `ancestor`.
*/
+ (CGRect)measureLayout:(RCTShadowView *)view relativeTo:(RCTShadowView *)ancestor;
@end

View File

@@ -0,0 +1,31 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
@interface RCTSparseArray : NSObject <NSCopying>
- (instancetype)initWithCapacity:(NSUInteger)capacity NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithSparseArray:(RCTSparseArray *)sparseArray NS_DESIGNATED_INITIALIZER;
+ (instancetype)sparseArray;
+ (instancetype)sparseArrayWithCapacity:(NSUInteger)capacity;
+ (instancetype)sparseArrayWithSparseArray:(RCTSparseArray *)sparseArray;
// Use nil object to remove at idx.
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
// Use nil obj to remove at key.
- (void)setObject:(id)obj forKeyedSubscript:(NSNumber *)key;
- (id)objectForKeyedSubscript:(NSNumber *)key;
@property (readonly, nonatomic) NSUInteger count;
@property (readonly, nonatomic, copy) NSArray *allIndexes;
@property (readonly, nonatomic, copy) NSArray *allObjects;
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSNumber *idx, BOOL *stop))block;
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSNumber *idx, BOOL *stop))block;
- (void)removeAllObjects;
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@interface RCTStaticImage : UIImageView
@property (nonatomic, assign) UIEdgeInsets capInsets;
@property (nonatomic, assign) UIImageRenderingMode renderingMode;
@end

View File

@@ -0,0 +1,7 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTStaticImageManager : RCTViewManager
@end

View File

@@ -0,0 +1,9 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
@interface RCTStatusBarManager : NSObject <RCTBridgeModule>
@end

View File

@@ -0,0 +1,15 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@class RCTEventDispatcher;
@interface RCTTextField : UITextField
@property (nonatomic, assign) BOOL caretHidden;
@property (nonatomic, assign) BOOL autoCorrect;
@property (nonatomic, assign) UIEdgeInsets paddingEdgeInsets; // TODO: contentInset
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher;
@end

View File

@@ -0,0 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTTextFieldManager : RCTViewManager
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <Foundation/Foundation.h>
#import "RCTBridgeModule.h"
#import "RCTInvalidating.h"
@interface RCTTiming : NSObject <RCTBridgeModule, RCTInvalidating>
@end

View File

@@ -0,0 +1,15 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTInvalidating.h"
@class RCTBridge;
@interface RCTTouchHandler : UIGestureRecognizer<RCTInvalidating>
- (instancetype)initWithBridge:(RCTBridge *)bridge;
- (void)startOrResetInteractionTiming;
- (NSDictionary *)endAndResetInteractionTiming;
@end

View File

@@ -0,0 +1,7 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTViewManager.h"
@interface RCTUIActivityIndicatorViewManager : RCTViewManager
@end

View File

@@ -0,0 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
#import "RCTInvalidating.h"
@class RCTRootView;
@protocol RCTScrollableProtocol;
@interface RCTUIManager : NSObject <RCTBridgeModule, RCTInvalidating>
@property (nonatomic, weak) id<RCTScrollableProtocol> mainScrollView;
/**
* Allows native environment code to respond to "the main scroll view" events.
* see `RCTUIManager`'s `setMainScrollViewTag`.
*/
@property (nonatomic, readwrite, weak) id<UIScrollViewDelegate> nativeMainScrollDelegate;
- (void)registerRootView:(RCTRootView *)rootView;
+ (UIView *)JSResponder;
@end

View File

@@ -0,0 +1,41 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <tgmath.h>
#import "RCTAssert.h"
// Macro to indicate when inherited initializer is not to be used
#define RCT_NOT_DESIGNATED_INITIALIZER() \
do { \
RCTAssert(NO, @"%@ is not the designated initializer for instances of %@.", NSStringFromSelector(_cmd), [self class]); \
return nil; \
} while (0)
// Utility functions for JSON object <-> string serialization/deserialization
NSString *RCTJSONStringify(id jsonObject, NSError **error);
id RCTJSONParse(NSString *jsonString, NSError **error);
// Get MD5 hash of a string (TODO: currently unused. Remove?)
NSString *RCTMD5Hash(NSString *string);
// Get screen metrics in a thread-safe way
CGFloat RCTScreenScale(void);
CGSize RCTScreenSize(void);
// Round float coordinates to nearest whole screen pixel (not point)
CGFloat RCTRoundPixelValue(CGFloat value);
CGFloat RCTCeilPixelValue(CGFloat value);
CGFloat RCTFloorPixelValue(CGFloat value);
// Get current time, for precise performance metrics
NSTimeInterval RCTTGetAbsoluteTime(void);
// Method swizzling
void RCTSwapClassMethods(Class cls, SEL original, SEL replacement);
void RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement);
// Module subclass support
BOOL RCTClassOverridesClassMethod(Class cls, SEL selector);
BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector);

View File

@@ -0,0 +1,24 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "RCTView.h"
#import <UIKit/UIKit.h>
#import "RCTPointerEvents.h"
@protocol RCTAutoInsetsProtocol;
@interface RCTView : UIView
@property (nonatomic, assign) RCTPointerEvents pointerEvents;
@property (nonatomic, copy) NSString *overrideAccessibilityLabel;
+ (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
withScrollView:(UIScrollView *)scrollView
updateOffset:(BOOL)updateOffset;
+ (UIViewController *)backingViewControllerForView:(UIView *)view;
+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView;
@end

View File

@@ -0,0 +1,148 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTConvert.h"
#import "RCTLog.h"
@class RCTEventDispatcher;
@class RCTShadowView;
@class RCTSparseArray;
@class RCTUIManager;
typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, RCTSparseArray *viewRegistry);
@interface RCTViewManager : NSObject
/**
* Designated initializer for view modules. Override this when subclassing.
*/
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;
/**
* The event dispatcher is used to send events back to the JavaScript application.
* It can either be used directly by the module, or passed on to instantiated
* view subclasses so that they can handle their own events.
*/
@property (nonatomic, readonly, weak) RCTEventDispatcher *eventDispatcher;
/**
* The module name exposed to React JS. If omitted, this will be inferred
* automatically by using the view module's class name. It is better to not
* override this, and just follow standard naming conventions for your view
* module subclasses.
*/
+ (NSString *)moduleName;
/**
* This method instantiates a native view to be managed by the module. Override
* this to return a custom view instance, which may be preconfigured with default
* properties, subviews, etc. This method will be called many times, and should
* return a fresh instance each time. The view module MUST NOT cache the returned
* view and return the same instance for subsequent calls.
*/
- (UIView *)view;
/**
* This method instantiates a shadow view to be managed by the module. If omitted,
* an ordinary RCTShadowView instance will be created, which is typically fine for
* most view types. As with the -view method, the -shadowView method should return
* a fresh instance each time it is called.
*/
- (RCTShadowView *)shadowView;
/**
* Returns a dictionary of config data passed to JS that defines eligible events
* that can be placed on native views. This should return bubbling
* directly-dispatched event types and specify what names should be used to
* subscribe to either form (bubbling/capturing).
*
* Returned dictionary should be of the form: @{
* @"onTwirl": {
* @"phasedRegistrationNames": @{
* @"bubbled": @"onTwirl",
* @"captured": @"onTwirlCaptured"
* }
* }
* }
*
* Note that this method is not inherited when you subclass a view module, and
* you should not call [super customBubblingEventTypes] when overriding it.
*/
+ (NSDictionary *)customBubblingEventTypes;
/**
* Returns a dictionary of config data passed to JS that defines eligible events
* that can be placed on native views. This should return non-bubbling
* directly-dispatched event types.
*
* Returned dictionary should be of the form: @{
* @"onTwirl": {
* @"registrationName": @"onTwirl"
* }
* }
*
* Note that this method is not inherited when you subclass a view module, and
* you should not call [super customDirectEventTypes] when overriding it.
*/
+ (NSDictionary *)customDirectEventTypes;
/**
* Injects constants into JS. These constants are made accessible via
* NativeModules.moduleName.X. Note that this method is not inherited when you
* subclass a view module, and you should not call [super constantsToExport]
* when overriding it.
*/
+ (NSDictionary *)constantsToExport;
/**
* To deprecate, hopefully
*/
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(RCTSparseArray *)shadowViewRegistry;
/**
* Informal protocol for setting view and shadowView properties.
* Implement methods matching these patterns to set any properties that
* require special treatment (e.g. where the type or name cannot be inferred).
*
* - (void)set_<propertyName>:(id)property
* forView:(UIView *)view
* withDefaultView:(UIView *)defaultView;
*
* - (void)set_<propertyName>:(id)property
* forShadowView:(RCTShadowView *)view
* withDefaultView:(RCTShadowView *)defaultView;
*
* For simple cases, use the macros below:
*/
/**
* This handles the simple case, where JS and native property names match
* And the type can be automatically inferred.
*/
#define RCT_EXPORT_VIEW_PROPERTY(name) \
RCT_REMAP_VIEW_PROPERTY(name, name)
/**
* This macro maps a named property on the module to an arbitrary key path
* within the view.
*/
#define RCT_REMAP_VIEW_PROPERTY(name, keypath) \
- (void)set_##name:(id)json forView:(id)view withDefaultView:(id)defaultView { \
if ((json && !RCTSetProperty(view, @#keypath, json)) || \
(!json && !RCTCopyProperty(view, defaultView, @#keypath))) { \
RCTLogMustFix(@"%@ does not have setter for `%s` property", [view class], #name); \
} \
}
/**
* These are useful in cases where the module's superclass handles a
* property, but you wish to "unhandle" it, so it will be ignored.
*/
#define RCT_IGNORE_VIEW_PROPERTY(name) \
- (void)set_##name:(id)value forView:(id)view withDefaultView:(id)defaultView {}
#define RCT_IGNORE_SHADOW_PROPERTY(name) \
- (void)set_##name:(id)value forShadowView:(id)view withDefaultView:(id)defaultView {}
@end

View File

@@ -0,0 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
/**
* Logical node in a tree of application components. Both `ShadowView`s and
* `UIView+ReactKit`s conform to this. Allows us to write utilities that
* reason about trees generally.
*/
@protocol RCTViewNodeProtocol <NSObject>
@property (nonatomic, strong) NSNumber *reactTag;
- (void)insertReactSubview:(id<RCTViewNodeProtocol>)subview atIndex:(NSInteger)atIndex;
- (void)removeReactSubview:(id<RCTViewNodeProtocol>)subview;
- (NSMutableArray *)reactSubviews;
- (NSNumber *)reactTagAtPoint:(CGPoint)point;
// View is an RCTRootView
- (BOOL)isReactRootView;
@optional
// TODO: Deprecate this
- (void)reactBridgeDidFinishTransaction;
@end

View File

@@ -0,0 +1,35 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTJavaScriptExecutor.h"
/**
* Uses an embedded web view merely for the purpose of being able to reuse the
* existing webkit debugging tools. Fulfills the role of a very constrained
* `JSContext`, which we call `RCTJavaScriptExecutor`.
*
* TODO: To ensure production-identical execution, scrub the window
* environment. And ensure main thread operations are actually added to a queue
* instead of being executed immediately if already on the main thread.
*/
@interface RCTWebViewExecutor : NSObject<RCTJavaScriptExecutor>
// Only one callback stored - will only be invoked for the latest issued
// application script request.
@property (nonatomic, copy) RCTJavaScriptCompleteBlock onApplicationScriptLoaded;
/**
* Instantiate with a specific webview instance
*/
- (instancetype)initWithWebView:(UIWebView *)webView NS_DESIGNATED_INITIALIZER;
/**
* Invoke this to reclaim the web view for reuse. This is necessary in order to
* allow debuggers to remain open, when creating a new `RCTWebViewExecutor`.
* This guards against the web view being invalidated, and makes sure the
* `delegate` is cleared first.
*/
- (UIWebView *)invalidateAndReclaimWebView;
@end

View File

@@ -0,0 +1,24 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
@class RCTEventDispatcher;
@class RCTNavItem;
@class RCTWrapperViewController;
@protocol RCTWrapperViewControllerNavigationListener <NSObject>
- (void)wrapperViewController:(RCTWrapperViewController *)wrapperViewController
didMoveToNavigationController:(UINavigationController *)navigationController;
@end
@interface RCTWrapperViewController : UIViewController
- (instancetype)initWithContentView:(UIView *)contentView eventDispatcher:(RCTEventDispatcher *)eventDispatcher;
- (instancetype)initWithNavItem:(RCTNavItem *)navItem eventDispatcher:(RCTEventDispatcher *)eventDispatcher;
@property (nonatomic, readwrite, weak) id<RCTWrapperViewControllerNavigationListener> navigationListener;
@property (nonatomic, strong, readwrite) RCTNavItem *navItem;
@end

View File

@@ -0,0 +1,11 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import <UIKit/UIKit.h>
#import "RCTViewNodeProtocol.h"
//TODO: let's try to eliminate this category if possible
@interface UIView (ReactKit) <RCTViewNodeProtocol>
@end

View File

@@ -0,0 +1,28 @@
Pod::Spec.new do |spec|
spec.name = 'RCTDataManager'
spec.version = '0.0.1'
spec.summary = 'Provides basic networking capabilities in ReactNative apps.'
spec.description = <<-DESC
Use XMLHttpRequest to fetch data over the network.
DESC
spec.homepage = 'https://facebook.github.io/react-native/'
spec.license = { :type => 'BSD' }
spec.author = 'Facebook'
spec.platform = :ios, '7.0'
spec.requires_arc = true
spec.source_files = '**/*.{h,m,c}'
spec.dependency "ReactKit", "~> 0.0.1"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#
# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"
# s.library = "iconv"
#spec.libraries = "RCTDataManager", "ReactKit"
end

View File

@@ -0,0 +1,28 @@
Pod::Spec.new do |spec|
spec.name = 'RCTNetworkImage'
spec.version = '0.0.1'
spec.summary = 'Provides basic Text capabilities in ReactNative apps.'
spec.description = <<-DESC
Text can be rendered in ReactNative apps with the <Text> component using this module.
DESC
spec.homepage = 'https://facebook.github.io/react-native/'
spec.license = { :type => 'BSD' }
spec.author = 'Facebook'
spec.platform = :ios, '7.0'
spec.requires_arc = true
spec.source_files = '**/*.{h,m,c}'
spec.dependency "ReactKit", "~> 0.0.1"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#
# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"
# s.library = "iconv"
#spec.libraries = "RCTNetworkImage", "ReactKit"
end

View File

@@ -0,0 +1,28 @@
Pod::Spec.new do |spec|
spec.name = 'RCTText'
spec.version = '0.0.1'
spec.summary = 'Provides basic Text capabilities in ReactNative apps.'
spec.description = <<-DESC
Text can be rendered in ReactNative apps with the <Text> component using this module.
DESC
spec.homepage = 'https://facebook.github.io/react-native/'
spec.license = { :type => 'BSD' }
spec.author = 'Facebook'
spec.platform = :ios, '7.0'
spec.requires_arc = true
spec.source_files = '**/*.{h,m,c}'
spec.dependency "ReactKit", "~> 0.0.1"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#
# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"
# s.library = "iconv"
#spec.libraries = "RCTText", "ReactKit"
end

View File

@@ -0,0 +1,16 @@
Pod::Spec.new do |spec|
spec.name = 'ReactKit'
spec.version = '0.0.1'
spec.summary = 'An implementation of React that targets UIKit for iOS'
spec.description = <<-DESC
Our first React Native implementation is ReactKit, targeting iOS. We are also working on an Android implementation which we will release later. ReactKit apps are built using the React JS framework, and render directly to native UIKit elements using a fully asynchronous architecture. There is no browser and no HTML. We have picked what we think is the best set of features from these and other technologies to build what we hope to become the best product development framework available, with an emphasis on iteration speed, developer delight, continuity of technology, and absolutely beautiful and fast products with no compromises in quality or capability.
DESC
spec.homepage = 'https://facebook.github.io/react-native/'
spec.license = { :type => 'BSD' }
spec.author = 'Facebook'
spec.platform = :ios, '7.0'
spec.requires_arc = true
spec.source_files = '**/*.{h,m,c}'
spec.public_header_files = "**/*.h"
#spec.library = "ReactKit"
end

32
Examples/Movies/Pods/Manifest.lock generated Normal file
View File

@@ -0,0 +1,32 @@
PODS:
- RCTDataManager (0.0.1):
- ReactKit (~> 0.0.1)
- RCTNetworkImage (0.0.1):
- ReactKit (~> 0.0.1)
- RCTText (0.0.1):
- ReactKit (~> 0.0.1)
- ReactKit (0.0.1)
DEPENDENCIES:
- RCTDataManager (from `../../Libraries/Network`)
- RCTNetworkImage (from `../../Libraries/Image`)
- RCTText (from `../../Libraries/Text`)
- ReactKit (from `../../ReactKit`)
EXTERNAL SOURCES:
RCTDataManager:
:path: ../../Libraries/Network
RCTNetworkImage:
:path: ../../Libraries/Image
RCTText:
:path: ../../Libraries/Text
ReactKit:
:path: ../../ReactKit
SPEC CHECKSUMS:
RCTDataManager: d38d2a6555886d68e8de623c4b97e2acdf01ed3e
RCTNetworkImage: 6d99735875916e098a65c68a54a72e67e24a402a
RCTText: 5c0cf4635241e8c02e8933853df03809d2dc8327
ReactKit: 65c02c1e95951c198e491d2a4c1972675d4af254
COCOAPODS: 0.35.0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
#include "Pods-RCTDataManager.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/RCTDataManager" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RCTDataManager" "${PODS_ROOT}/Headers/Public/RCTNetworkImage" "${PODS_ROOT}/Headers/Public/RCTText" "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_LDFLAGS = -ObjC
PODS_ROOT = ${SRCROOT}

View File

@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_RCTDataManager : NSObject
@end
@implementation PodsDummy_Pods_RCTDataManager
@end

View File

@@ -0,0 +1,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"

View File

@@ -0,0 +1,5 @@
#include "Pods-RCTNetworkImage.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/RCTNetworkImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RCTDataManager" "${PODS_ROOT}/Headers/Public/RCTNetworkImage" "${PODS_ROOT}/Headers/Public/RCTText" "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_LDFLAGS = -ObjC
PODS_ROOT = ${SRCROOT}

View File

@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_RCTNetworkImage : NSObject
@end
@implementation PodsDummy_Pods_RCTNetworkImage
@end

View File

@@ -0,0 +1,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"

View File

@@ -0,0 +1,5 @@
#include "Pods-RCTText.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/RCTText" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RCTDataManager" "${PODS_ROOT}/Headers/Public/RCTNetworkImage" "${PODS_ROOT}/Headers/Public/RCTText" "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_LDFLAGS = -ObjC
PODS_ROOT = ${SRCROOT}

View File

@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_RCTText : NSObject
@end
@implementation PodsDummy_Pods_RCTText
@end

View File

@@ -0,0 +1,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"

View File

@@ -0,0 +1,5 @@
#include "Pods-ReactKit.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/ReactKit" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RCTDataManager" "${PODS_ROOT}/Headers/Public/RCTNetworkImage" "${PODS_ROOT}/Headers/Public/RCTText" "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_LDFLAGS = -ObjC
PODS_ROOT = ${SRCROOT}

View File

@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_ReactKit : NSObject
@end
@implementation PodsDummy_Pods_ReactKit
@end

View File

@@ -0,0 +1,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"

View File

@@ -0,0 +1,3 @@
# Acknowledgements
This application makes use of the following third party libraries:
Generated by CocoaPods - http://cocoapods.org

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>

View File

@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end

View File

@@ -0,0 +1,32 @@
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// RCTDataManager
#define COCOAPODS_POD_AVAILABLE_RCTDataManager
#define COCOAPODS_VERSION_MAJOR_RCTDataManager 0
#define COCOAPODS_VERSION_MINOR_RCTDataManager 0
#define COCOAPODS_VERSION_PATCH_RCTDataManager 1
// RCTNetworkImage
#define COCOAPODS_POD_AVAILABLE_RCTNetworkImage
#define COCOAPODS_VERSION_MAJOR_RCTNetworkImage 0
#define COCOAPODS_VERSION_MINOR_RCTNetworkImage 0
#define COCOAPODS_VERSION_PATCH_RCTNetworkImage 1
// RCTText
#define COCOAPODS_POD_AVAILABLE_RCTText
#define COCOAPODS_VERSION_MAJOR_RCTText 0
#define COCOAPODS_VERSION_MINOR_RCTText 0
#define COCOAPODS_VERSION_PATCH_RCTText 1
// ReactKit
#define COCOAPODS_POD_AVAILABLE_ReactKit
#define COCOAPODS_VERSION_MAJOR_ReactKit 0
#define COCOAPODS_VERSION_MINOR_ReactKit 0
#define COCOAPODS_VERSION_PATCH_ReactKit 1

View File

@@ -0,0 +1,74 @@
#!/bin/sh
set -e
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
;;
*.framework)
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*.xcdatamodel)
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom"
;;
*.xcdatamodeld)
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
*.xcmappingmodel)
echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\""
xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
;;
*.xcassets)
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
;;
esac
}
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]]; then
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
rm -f "$RESOURCES_TO_COPY"
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ]
then
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

View File

@@ -0,0 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RCTDataManager" "${PODS_ROOT}/Headers/Public/RCTNetworkImage" "${PODS_ROOT}/Headers/Public/RCTText" "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RCTDataManager" -isystem "${PODS_ROOT}/Headers/Public/RCTNetworkImage" -isystem "${PODS_ROOT}/Headers/Public/RCTText" -isystem "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_LDFLAGS = -ObjC -l"Pods-RCTDataManager" -l"Pods-RCTNetworkImage" -l"Pods-RCTText" -l"Pods-ReactKit"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
PODS_ROOT = ${SRCROOT}/Pods

View File

@@ -0,0 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RCTDataManager" "${PODS_ROOT}/Headers/Public/RCTNetworkImage" "${PODS_ROOT}/Headers/Public/RCTText" "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RCTDataManager" -isystem "${PODS_ROOT}/Headers/Public/RCTNetworkImage" -isystem "${PODS_ROOT}/Headers/Public/RCTText" -isystem "${PODS_ROOT}/Headers/Public/ReactKit"
OTHER_LDFLAGS = -ObjC -l"Pods-RCTDataManager" -l"Pods-RCTNetworkImage" -l"Pods-RCTText" -l"Pods-ReactKit"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
PODS_ROOT = ${SRCROOT}/Pods