Updates from Wed Mar 4

- [ReactNative] modernize DatePicker | Spencer Ahrens
- React Native: Force !ExecutionEnvironment.canUseDOM | Tim Yung
- [react-packager] Recover and warn from corrupted cache file | Amjad Masad
- [ReactNative] Github repo's gitignore is written at export | Amjad Masad
- [ReactNative] Use strings instead of constants for keyboardDismissMode | Christopher Chedeau
This commit is contained in:
Christopher Chedeau 2015-03-04 08:05:38 -08:00
parent 86aa5f80dc
commit 7b0cd86759
10 changed files with 83 additions and 527 deletions

View File

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

View File

@ -239,7 +239,7 @@ var SearchScreen = React.createClass({
renderRow={this.renderRow}
onEndReached={this.onEndReached}
automaticallyAdjustContentInsets={false}
keyboardDismissMode={ScrollView.keyboardDismissMode.OnDrag}
keyboardDismissMode="onDrag"
keyboardShouldPersistTaps={true}
showsVerticalScrollIndicator={false}
/>;

View File

@ -1,44 +0,0 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "AppDelegate.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
RCTRootView *rootView = [[RCTRootView alloc] init];
// Loading JavaScript code - uncomment the one you want.
// OPTION 1
// Load from development server. Start the server from the repository root:
//
// $ npm start
//
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
// iOS device are on the same Wi-Fi network.
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle"];
// OPTION 2
// Load from pre-bundled file on disk. To re-generate the static bundle, run
//
// $ curl http://localhost:8081/Examples/TicTacToe/TicTacToeApp.includeRequire.runModule.bundle -o main.jsbundle
//
// and uncomment the next following line
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
rootView.scriptURL = jsCodeLocation;
rootView.moduleName = @"TicTacToeApp";
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
@end

View File

@ -1,407 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
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 */; };
587650E91A9EB103008B8F17 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 587650E01A9EB0DB008B8F17 /* libRCTText.a */; };
587650EA1A9EB103008B8F17 /* libReactKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 587650E81A9EB0E0008B8F17 /* libReactKit.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
587650DF1A9EB0DB008B8F17 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 587650DA1A9EB0DB008B8F17 /* RCTText.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
587650E11A9EB0DB008B8F17 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 587650DA1A9EB0DB008B8F17 /* RCTText.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511A61A9E6C1300147676;
remoteInfo = RCTTextTests;
};
587650E71A9EB0E0008B8F17 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 587650E31A9EB0DF008B8F17 /* ReactKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = ReactKit;
};
58C571DE1AA6119300CDF9C8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 58C571D91AA6119300CDF9C8 /* RCTNetworkImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
remoteInfo = RCTNetworkImage;
};
58C571E01AA6119300CDF9C8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 58C571D91AA6119300CDF9C8 /* RCTNetworkImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511681A9E6B3D00147676;
remoteInfo = RCTNetworkImageTests;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
13B07F961A680F5B00A75B9A /* TicTacToe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TicTacToe.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
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>"; };
587650DA1A9EB0DB008B8F17 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "/Users/sahrens/src/fbobjc-hg/Libraries/FBReactKit/js/react-native-github/Libraries/RCTStandardLibrary/../Text/RCTText.xcodeproj"; sourceTree = "<absolute>"; };
587650E31A9EB0DF008B8F17 /* ReactKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactKit.xcodeproj; path = "/Users/sahrens/src/fbobjc-hg/Libraries/FBReactKit/js/react-native-github/Libraries/RCTStandardLibrary/../../ReactKit/ReactKit.xcodeproj"; sourceTree = "<absolute>"; };
58C571D91AA6119300CDF9C8 /* RCTNetworkImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetworkImage.xcodeproj; path = "/Users/sahrens/src/fbobjc-hg/Libraries/FBReactKit/js/react-native-github/Libraries/Text/../Image/RCTNetworkImage.xcodeproj"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
587650E91A9EB103008B8F17 /* libRCTText.a in Frameworks */,
587650EA1A9EB103008B8F17 /* libReactKit.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
13B07FAE1A68108700A75B9A /* TicTacToe */ = {
isa = PBXGroup;
children = (
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
13B07FB61A68108700A75B9A /* Info.plist */,
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
13B07FB71A68108700A75B9A /* main.m */,
);
name = TicTacToe;
sourceTree = "<group>";
};
587650DB1A9EB0DB008B8F17 /* Products */ = {
isa = PBXGroup;
children = (
587650E01A9EB0DB008B8F17 /* libRCTText.a */,
587650E21A9EB0DB008B8F17 /* RCTTextTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
587650E41A9EB0DF008B8F17 /* Products */ = {
isa = PBXGroup;
children = (
587650E81A9EB0E0008B8F17 /* libReactKit.a */,
);
name = Products;
sourceTree = "<group>";
};
58C571DA1AA6119300CDF9C8 /* Products */ = {
isa = PBXGroup;
children = (
58C571DF1AA6119300CDF9C8 /* libRCTNetworkImage.a */,
58C571E11AA6119300CDF9C8 /* RCTNetworkImageTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
13B07FAE1A68108700A75B9A /* TicTacToe */,
58C571D91AA6119300CDF9C8 /* RCTNetworkImage.xcodeproj */,
587650DA1A9EB0DB008B8F17 /* RCTText.xcodeproj */,
587650E31A9EB0DF008B8F17 /* ReactKit.xcodeproj */,
83CBBA001A601CBA00E9B192 /* Products */,
);
sourceTree = "<group>";
};
83CBBA001A601CBA00E9B192 /* Products */ = {
isa = PBXGroup;
children = (
13B07F961A680F5B00A75B9A /* TicTacToe.app */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
13B07F861A680F5B00A75B9A /* TicTacToe */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TicTacToe" */;
buildPhases = (
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TicTacToe;
productName = "Hello World";
productReference = 13B07F961A680F5B00A75B9A /* TicTacToe.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook;
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "TicTacToe" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 58C571DA1AA6119300CDF9C8 /* Products */;
ProjectRef = 58C571D91AA6119300CDF9C8 /* RCTNetworkImage.xcodeproj */;
},
{
ProductGroup = 587650DB1A9EB0DB008B8F17 /* Products */;
ProjectRef = 587650DA1A9EB0DB008B8F17 /* RCTText.xcodeproj */;
},
{
ProductGroup = 587650E41A9EB0DF008B8F17 /* Products */;
ProjectRef = 587650E31A9EB0DF008B8F17 /* ReactKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* TicTacToe */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
587650E01A9EB0DB008B8F17 /* libRCTText.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTText.a;
remoteRef = 587650DF1A9EB0DB008B8F17 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
587650E21A9EB0DB008B8F17 /* RCTTextTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = RCTTextTests.xctest;
remoteRef = 587650E11A9EB0DB008B8F17 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
587650E81A9EB0E0008B8F17 /* libReactKit.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReactKit.a;
remoteRef = 587650E71A9EB0E0008B8F17 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
58C571DF1AA6119300CDF9C8 /* libRCTNetworkImage.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTNetworkImage.a;
remoteRef = 58C571DE1AA6119300CDF9C8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
58C571E11AA6119300CDF9C8 /* RCTNetworkImageTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = RCTNetworkImageTests.xctest;
remoteRef = 58C571E01AA6119300CDF9C8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
isa = PBXVariantGroup;
children = (
13B07FB21A68108700A75B9A /* Base */,
);
name = LaunchScreen.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = TicTacToe;
};
name = Debug;
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = TicTacToe;
};
name = Release;
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../ReactKit/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
83CBBA211A601CBA00E9B192 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../ReactKit/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TicTacToe" */ = {
isa = XCConfigurationList;
buildConfigurations = (
13B07F941A680F5B00A75B9A /* Debug */,
13B07F951A680F5B00A75B9A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "TicTacToe" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,
83CBBA211A601CBA00E9B192 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:TicTacToe.xcodeproj">
</FileRef>
</Workspace>

View File

@ -30,8 +30,7 @@ var UIExplorerPage = React.createClass({
} else {
ContentWrapper = ScrollView;
wrapperProps.keyboardShouldPeristTaps = true;
wrapperProps.keyboardDismissMode =
ScrollView.keyboardDismissMode.Interactive;
wrapperProps.keyboardDismissMode = 'interactive';
}
var title = this.props.title ?
<UIExplorerTitle title={this.props.title} /> :

View File

@ -31,6 +31,12 @@ var PropTypes = React.PropTypes;
var SCROLLVIEW = 'ScrollView';
var INNERVIEW = 'InnerScrollView';
var keyboardDismissModeConstants = {
'none': RKScrollViewConsts.KeyboardDismissMode.None, // default
'interactive': RKScrollViewConsts.KeyboardDismissMode.Interactive,
'onDrag': RKScrollViewConsts.KeyboardDismissMode.OnDrag,
};
/**
* `React` component that wraps platform `RKScrollView` while providing
* integration with touch locking "responder" system.
@ -80,8 +86,8 @@ var INNERVIEW = 'InnerScrollView';
/**
* A floating-point number that determines how quickly the scroll view
* decelerates after the user lifts their finger. Reasonable choices include
* `RKScrollView.Constants.DecelerationRate.Normal` (the default) and
* `RKScrollView.Constants.DecelerationRate.Fast`.
* - Normal: 0.998 (the default)
* - Fast: 0.9
*/
decelerationRate: nativePropType(PropTypes.number),
/**
@ -91,18 +97,17 @@ var INNERVIEW = 'InnerScrollView';
horizontal: PropTypes.bool,
/**
* Determines whether the keyboard gets dismissed in response to a drag.
* When `ScrollView.keyboardDismissMode.None` (the default), drags do not
* dismiss the keyboard. When `ScrollView.keyboardDismissMode.OnDrag`, the
* keyboard is dismissed when a drag begins. When
* `ScrollView.keyboardDismissMode.Interactive`, the keyboard is dismissed
* interactively with the drag and moves in synchrony with the touch;
* dragging upwards cancels the dismissal.
* - 'none' (the default), drags do not dismiss the keyboard.
* - 'onDrag', the keyboard is dismissed when a drag begins.
* - 'interactive', the keyboard is dismissed interactively with the drag
* and moves in synchrony with the touch; dragging upwards cancels the
* dismissal.
*/
keyboardDismissMode: nativePropType(PropTypes.oneOf([
RKScrollViewConsts.KeyboardDismissMode.None, // default
RKScrollViewConsts.KeyboardDismissMode.Interactive,
RKScrollViewConsts.KeyboardDismissMode.OnDrag,
])),
keyboardDismissMode: PropTypes.oneOf([
'none', // default
'interactive',
'onDrag',
]),
/**
* When false, tapping outside of the focused text input when the keyboard
* is up dismisses the keyboard. When true, the scroll view will not catch
@ -154,7 +159,6 @@ var INNERVIEW = 'InnerScrollView';
var ScrollView = React.createClass({
statics: {
PropTypes: RKScrollViewPropTypes,
keyboardDismissMode: RKScrollViewConsts.KeyboardDismissMode,
},
propTypes: RKScrollViewPropTypes,
@ -230,6 +234,9 @@ var ScrollView = React.createClass({
this.props, {
alwaysBounceHorizontal,
alwaysBounceVertical,
keyboardDismissMode: this.props.keyboardDismissMode ?
keyboardDismissModeConstants[this.props.keyboardDismissMode] :
undefined,
style: [styles.base, this.props.style],
onTouchStart: this.scrollResponderHandleTouchStart,
onTouchMove: this.scrollResponderHandleTouchMove,

View File

@ -17,16 +17,8 @@
/* eslint global-strict: 0 */
/* globals GLOBAL: true, window: true */
var JSTimers = require('JSTimers');
// Just to make sure the JS gets packaged up
// Just to make sure the JS gets packaged up.
require('RCTDeviceEventEmitter');
var ErrorUtils = require('ErrorUtils');
var RKAlertManager = require('RKAlertManager');
var RKExceptionsManager = require('NativeModules').RKExceptionsManager;
var errorToString = require('errorToString');
var loadSourceMap = require('loadSourceMap');
if (typeof GLOBAL === 'undefined') {
GLOBAL = this;
@ -36,7 +28,43 @@ if (typeof window === 'undefined') {
window = GLOBAL;
}
/**
* The document must be shimmed before anything else that might define the
* `ExecutionEnvironment` module (which checks for `document.createElement`).
*/
function setupDocumentShim() {
// The browser defines Text and Image globals by default. If you forget to
// require them, then the error message is very confusing.
function getInvalidGlobalUseError(name) {
return new Error(
'You are trying to render the global ' + name + ' variable as a ' +
'React element. You probably forgot to require ' + name + '.'
);
}
GLOBAL.Text = {
get defaultProps() {
throw getInvalidGlobalUseError('Text');
}
};
GLOBAL.Image = {
get defaultProps() {
throw getInvalidGlobalUseError('Image');
}
};
if (!GLOBAL.document) {
// This shouldn't be needed but scroller library fails without it. If
// we fixed the scroller, we wouldn't need this.
GLOBAL.document = {body: {}};
}
// Force `ExecutionEnvironment.canUseDOM` to be false.
GLOBAL.document.createElement = null;
}
function handleErrorWithRedBox(e) {
var RKExceptionsManager = require('NativeModules').RKExceptionsManager;
var errorToString = require('errorToString');
var loadSourceMap = require('loadSourceMap');
GLOBAL.console.error(
'Error: ' +
'\n stack: \n' + e.stack +
@ -60,38 +88,10 @@ function handleErrorWithRedBox(e) {
}
function setupRedBoxErrorHandler() {
var ErrorUtils = require('ErrorUtils');
ErrorUtils.setGlobalHandler(handleErrorWithRedBox);
}
function setupDocumentShim() {
// The browser defines Text and Image globals by default. If you forget to
// require them, then the error message is very confusing.
function getInvalidGlobalUseError(name) {
return new Error(
'You are trying to render the global ' + name + ' variable as a ' +
'React element. You probably forgot to require ' + name + '.'
);
}
GLOBAL.Text = {
get defaultProps() {
throw getInvalidGlobalUseError('Text');
}
};
GLOBAL.Image = {
get defaultProps() {
throw getInvalidGlobalUseError('Image');
}
};
GLOBAL.document = {
// This shouldn't be needed but scroller library fails without it. If
// we fixed the scroller, we wouldn't need this.
body: {},
// Workaround for setImmediate
createElement: function() {return {};}
};
}
/**
* Sets up a set of window environment wrappers that ensure that the
* BatchedBridge is flushed after each tick. In both the case of the
@ -100,6 +100,7 @@ function setupDocumentShim() {
* unexplainably dropped timing signals.
*/
function setupTimers() {
var JSTimers = require('JSTimers');
GLOBAL.setTimeout = JSTimers.setTimeout;
GLOBAL.setInterval = JSTimers.setInterval;
GLOBAL.setImmediate = JSTimers.setImmediate;
@ -114,6 +115,7 @@ function setupTimers() {
}
function setupAlert() {
var RKAlertManager = require('RKAlertManager');
if (!GLOBAL.alert) {
GLOBAL.alert = function(text) {
var alertOpts = {
@ -144,8 +146,8 @@ function setupGeolocation() {
GLOBAL.navigator.geolocation = require('GeoLocation');
}
setupRedBoxErrorHandler();
setupDocumentShim();
setupRedBoxErrorHandler();
setupTimers();
setupAlert();
setupPromise();

View File

@ -131,9 +131,12 @@ RCT_CONVERTER_CUSTOM(NSUInteger, NSUInteger, [json unsignedIntegerValue])
return [NSURLRequest requestWithURL:[self NSURL:json]];
}
RCT_CONVERTER_CUSTOM(NSDate *, NSDate, [NSDate dateWithTimeIntervalSince1970:[json doubleValue]])
RCT_CONVERTER_CUSTOM(NSTimeZone *, NSTimeZone, [NSTimeZone timeZoneForSecondsFromGMT:[json doubleValue]])
RCT_CONVERTER(NSTimeInterval, NSTimeInterval, doubleValue)
// JS Standard for time is milliseconds
RCT_CONVERTER_CUSTOM(NSDate *, NSDate, [NSDate dateWithTimeIntervalSince1970:[json doubleValue] / 1000.0])
RCT_CONVERTER_CUSTOM(NSTimeInterval, NSTimeInterval, [json doubleValue] / 1000.0)
// JS standard for time zones is minutes.
RCT_CONVERTER_CUSTOM(NSTimeZone *, NSTimeZone, [NSTimeZone timeZoneForSecondsFromGMT:[json doubleValue] * 60.0])
/**
* NOTE: We don't deliberately don't support NSTextAlignmentJustified in the

View File

@ -112,13 +112,23 @@ Cache.prototype._persistCache = function() {
return this._persisting;
};
function loadCacheSync(cacheFilepath) {
function loadCacheSync(cachePath) {
var ret = Object.create(null);
if (!fs.existsSync(cacheFilepath)) {
if (!fs.existsSync(cachePath)) {
return ret;
}
var cacheOnDisk = JSON.parse(fs.readFileSync(cacheFilepath));
var cacheOnDisk;
try {
cacheOnDisk = JSON.parse(fs.readFileSync(cachePath));
} catch (e) {
if (e instanceof SyntaxError) {
console.warn('Unable to parse cache file. Will clear and continue.');
fs.unlinkSync(cachePath);
return ret;
}
throw e;
}
// Filter outdated cache and convert to promises.
Object.keys(cacheOnDisk).forEach(function(key) {