Second Updates from Wed 25 Mar
- [MAdMan][Android] Make things look more Androidy | Philipp von Weitershausen - flowified Libraries from Avik | Basil Hosmer - flowify some Libraries | Basil Hosmer - [ReactKit] Add shake development menu | Alex Kotliarskyi - [ReactNative] Add debugger and change SampleApp files structure | Alex Kotliarskyi - Flowify ReactIOSEventEmitter | Marshall Roch - [react_native] JS files from D1941151: Allow fontWeight to be 100,200,...,900 | Krzysztof Magiera
This commit is contained in:
parent
b331a34af6
commit
53f791ed91
|
@ -12,7 +12,7 @@
|
||||||
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
|
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
|
||||||
.*/node_modules/react-tools/src/browser/.*
|
.*/node_modules/react-tools/src/browser/.*
|
||||||
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
|
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
|
||||||
.*/node_modules/react-tools/src/event/.*
|
.*/node_modules/react-tools/src/event/EventPropagators.js
|
||||||
|
|
||||||
# Ignore jest
|
# Ignore jest
|
||||||
.*/react-native/node_modules/jest-cli/.*
|
.*/react-native/node_modules/jest-cli/.*
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */; };
|
||||||
|
00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE91AC0C89D00671115 /* libicucore.dylib */; };
|
||||||
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
||||||
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; };
|
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; };
|
||||||
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
|
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
|
||||||
|
@ -22,6 +24,13 @@
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
00481BE51AC0C7FA00671115 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */;
|
||||||
|
proxyType = 2;
|
||||||
|
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
|
||||||
|
remoteInfo = RCTWebSocketDebugger;
|
||||||
|
};
|
||||||
00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
|
00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
|
containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
|
||||||
|
@ -81,19 +90,21 @@
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<absolute>"; };
|
00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = ../../Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj; sourceTree = "<group>"; };
|
||||||
|
00481BE91AC0C89D00671115 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
|
||||||
|
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<absolute>"; };
|
||||||
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = ../../Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = "<group>"; };
|
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = ../../Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = "<group>"; };
|
||||||
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../../Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = "<group>"; };
|
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../../Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = "<group>"; };
|
||||||
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
|
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
|
||||||
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
|
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
|
||||||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../../Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
|
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../../Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
|
||||||
13B07F961A680F5B00A75B9A /* SampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
13B07F961A680F5B00A75B9A /* SampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = SampleApp/AppDelegate.h; sourceTree = "<group>"; };
|
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = "<group>"; };
|
||||||
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = SampleApp/AppDelegate.m; sourceTree = "<group>"; };
|
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = "<group>"; };
|
||||||
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; 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; name = Images.xcassets; path = SampleApp/Images.xcassets; sourceTree = "<group>"; };
|
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = iOS/Images.xcassets; sourceTree = "<group>"; };
|
||||||
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = SampleApp/Info.plist; sourceTree = "<group>"; };
|
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = "<group>"; };
|
||||||
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = SampleApp/main.m; sourceTree = "<group>"; };
|
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = "<group>"; };
|
||||||
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
|
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
|
||||||
834D32361A76971A00F38302 /* ReactKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactKit.xcodeproj; path = ../../ReactKit/ReactKit.xcodeproj; sourceTree = "<group>"; };
|
834D32361A76971A00F38302 /* ReactKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactKit.xcodeproj; path = ../../ReactKit/ReactKit.xcodeproj; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
@ -103,6 +114,8 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */,
|
||||||
|
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */,
|
||||||
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
|
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
|
||||||
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */,
|
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */,
|
||||||
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
|
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
|
||||||
|
@ -117,6 +130,14 @@
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
00481BDC1AC0C7FA00671115 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
00C302A81ABCB8CE00DB3ED1 /* Products */ = {
|
00C302A81ABCB8CE00DB3ED1 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -189,6 +210,8 @@
|
||||||
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
|
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
|
||||||
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
|
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
|
||||||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
|
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
|
||||||
|
00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */,
|
||||||
|
00481BE91AC0C89D00671115 /* libicucore.dylib */,
|
||||||
);
|
);
|
||||||
name = Libraries;
|
name = Libraries;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -295,6 +318,10 @@
|
||||||
ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
|
ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
|
||||||
ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
|
ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ProductGroup = 00481BDC1AC0C7FA00671115 /* Products */;
|
||||||
|
ProjectRef = 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ProductGroup = 832348241A77B50100B55238 /* Products */;
|
ProductGroup = 832348241A77B50100B55238 /* Products */;
|
||||||
ProjectRef = 834D32361A76971A00F38302 /* ReactKit.xcodeproj */;
|
ProjectRef = 834D32361A76971A00F38302 /* ReactKit.xcodeproj */;
|
||||||
|
@ -308,6 +335,13 @@
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
||||||
/* Begin PBXReferenceProxy section */
|
/* Begin PBXReferenceProxy section */
|
||||||
|
00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */ = {
|
||||||
|
isa = PBXReferenceProxy;
|
||||||
|
fileType = archive.ar;
|
||||||
|
path = libRCTWebSocketDebugger.a;
|
||||||
|
remoteRef = 00481BE51AC0C7FA00671115 /* PBXContainerItemProxy */;
|
||||||
|
sourceTree = BUILT_PRODUCTS_DIR;
|
||||||
|
};
|
||||||
00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
|
00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
|
||||||
isa = PBXReferenceProxy;
|
isa = PBXReferenceProxy;
|
||||||
fileType = archive.ar;
|
fileType = archive.ar;
|
||||||
|
@ -397,7 +431,7 @@
|
||||||
13B07FB21A68108700A75B9A /* Base */,
|
13B07FB21A68108700A75B9A /* Base */,
|
||||||
);
|
);
|
||||||
name = LaunchScreen.xib;
|
name = LaunchScreen.xib;
|
||||||
path = SampleApp;
|
path = iOS;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
/* End PBXVariantGroup section */
|
/* End PBXVariantGroup section */
|
||||||
|
@ -407,7 +441,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/SampleApp/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
OTHER_LDFLAGS = "-ObjC";
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
PRODUCT_NAME = SampleApp;
|
PRODUCT_NAME = SampleApp;
|
||||||
|
@ -418,7 +452,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/SampleApp/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
OTHER_LDFLAGS = "-ObjC";
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
PRODUCT_NAME = SampleApp;
|
PRODUCT_NAME = SampleApp;
|
||||||
|
|
|
@ -27,12 +27,12 @@
|
||||||
//
|
//
|
||||||
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
|
// 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.
|
// iOS device are on the same Wi-Fi network.
|
||||||
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/SampleApp/index.ios.runModule.bundle"];
|
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/SampleApp/index.ios.bundle"];
|
||||||
|
|
||||||
// OPTION 2
|
// OPTION 2
|
||||||
// Load from pre-bundled file on disk. To re-generate the static bundle, run
|
// Load from pre-bundled file on disk. To re-generate the static bundle, run
|
||||||
//
|
//
|
||||||
// $ curl http://localhost:8081/Examples/SampleApp/index.ios.runModule.bundle -o main.jsbundle
|
// $ curl http://localhost:8081/Examples/SampleApp/index.ios.bundle -o main.jsbundle
|
||||||
//
|
//
|
||||||
// and uncomment the next following line
|
// and uncomment the next following line
|
||||||
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
|
||||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Facebook. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
|
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
|
||||||
<rect key="frame" x="20" y="439" width="441" height="21"/>
|
<rect key="frame" x="20" y="439" width="441" height="21"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
|
|
||||||
|
#import "RCTDevelopmentViewController.h"
|
||||||
#import "RCTRootView.h"
|
#import "RCTRootView.h"
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
@ -41,7 +42,7 @@
|
||||||
rootView.moduleName = @"UIExplorerApp";
|
rootView.moduleName = @"UIExplorerApp";
|
||||||
|
|
||||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||||
UIViewController *rootViewController = [[UIViewController alloc] init];
|
UIViewController *rootViewController = [[RCTDevelopmentViewController alloc] init];
|
||||||
rootViewController.view = rootView;
|
rootViewController.view = rootView;
|
||||||
self.window.rootViewController = rootViewController;
|
self.window.rootViewController = rootViewController;
|
||||||
[self.window makeKeyAndVisible];
|
[self.window makeKeyAndVisible];
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule NativeModules
|
* @providesModule NativeModules
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule RCTAlertManager
|
* @providesModule RCTAlertManager
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule RCTEventEmitter
|
* @providesModule RCTEventEmitter
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule RCTJSTimers
|
* @providesModule RCTJSTimers
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule CameraRoll
|
* @providesModule CameraRoll
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -28,7 +29,8 @@ var GROUP_TYPES_OPTIONS = [
|
||||||
'SavedPhotos', // default
|
'SavedPhotos', // default
|
||||||
];
|
];
|
||||||
|
|
||||||
deepFreezeAndThrowOnMutationInDev(GROUP_TYPES_OPTIONS);
|
// Flow treats Object and Array as disjoint types, currently.
|
||||||
|
deepFreezeAndThrowOnMutationInDev((GROUP_TYPES_OPTIONS: any));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shape of the param arg for the `getPhotos` function.
|
* Shape of the param arg for the `getPhotos` function.
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ActivityIndicatorIOS
|
* @providesModule ActivityIndicatorIOS
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -29,6 +30,12 @@ var SpinnerSize = keyMirror({
|
||||||
|
|
||||||
var GRAY = '#999999';
|
var GRAY = '#999999';
|
||||||
|
|
||||||
|
type DefaultProps = {
|
||||||
|
animating: boolean;
|
||||||
|
size: 'small' | 'large';
|
||||||
|
color: string;
|
||||||
|
};
|
||||||
|
|
||||||
var ActivityIndicatorIOS = React.createClass({
|
var ActivityIndicatorIOS = React.createClass({
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
||||||
|
@ -51,7 +58,7 @@ var ActivityIndicatorIOS = React.createClass({
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function(): DefaultProps {
|
||||||
return {
|
return {
|
||||||
animating: true,
|
animating: true,
|
||||||
size: SpinnerSize.small,
|
size: SpinnerSize.small,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule DatePickerIOS
|
* @providesModule DatePickerIOS
|
||||||
|
* @flow
|
||||||
*
|
*
|
||||||
* This is a controlled component version of RCTDatePickerIOS
|
* This is a controlled component version of RCTDatePickerIOS
|
||||||
*/
|
*/
|
||||||
|
@ -26,6 +27,12 @@ var merge = require('merge');
|
||||||
|
|
||||||
var DATEPICKER = 'datepicker';
|
var DATEPICKER = 'datepicker';
|
||||||
|
|
||||||
|
type DefaultProps = {
|
||||||
|
mode: 'date' | 'time' | 'datetime';
|
||||||
|
};
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use `DatePickerIOS` to render a date/time picker (selector) on iOS. This is
|
* Use `DatePickerIOS` to render a date/time picker (selector) on iOS. This is
|
||||||
* a controlled component, so you must hook in to the `onDateChange` callback
|
* a controlled component, so you must hook in to the `onDateChange` callback
|
||||||
|
@ -85,13 +92,13 @@ var DatePickerIOS = React.createClass({
|
||||||
timeZoneOffsetInMinutes: PropTypes.number,
|
timeZoneOffsetInMinutes: PropTypes.number,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function(): DefaultProps {
|
||||||
return {
|
return {
|
||||||
mode: 'datetime',
|
mode: 'datetime',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChange: function(event) {
|
_onChange: function(event: Event) {
|
||||||
var nativeTimeStamp = event.nativeEvent.timestamp;
|
var nativeTimeStamp = event.nativeEvent.timestamp;
|
||||||
this.props.onDateChange && this.props.onDateChange(
|
this.props.onDateChange && this.props.onDateChange(
|
||||||
new Date(nativeTimeStamp)
|
new Date(nativeTimeStamp)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule MapView
|
* @providesModule MapView
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ var deepDiffer = require('deepDiffer');
|
||||||
var insetsDiffer = require('insetsDiffer');
|
var insetsDiffer = require('insetsDiffer');
|
||||||
var merge = require('merge');
|
var merge = require('merge');
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
var MapView = React.createClass({
|
var MapView = React.createClass({
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
||||||
|
@ -119,7 +122,7 @@ var MapView = React.createClass({
|
||||||
onRegionChangeComplete: React.PropTypes.func,
|
onRegionChangeComplete: React.PropTypes.func,
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChange: function(event) {
|
_onChange: function(event: Event) {
|
||||||
if (event.nativeEvent.continuous) {
|
if (event.nativeEvent.continuous) {
|
||||||
this.props.onRegionChange &&
|
this.props.onRegionChange &&
|
||||||
this.props.onRegionChange(event.nativeEvent.region);
|
this.props.onRegionChange(event.nativeEvent.region);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule NavigatorIOS
|
* @providesModule NavigatorIOS
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ var RCTNavigatorItem = createReactIOSNativeComponentClass({
|
||||||
var NavigatorTransitionerIOS = React.createClass({
|
var NavigatorTransitionerIOS = React.createClass({
|
||||||
requestSchedulingNavigation: function(cb) {
|
requestSchedulingNavigation: function(cb) {
|
||||||
RCTNavigatorManager.requestSchedulingJavaScriptNavigation(
|
RCTNavigatorManager.requestSchedulingJavaScriptNavigation(
|
||||||
this.getNodeHandle(),
|
(this: any).getNodeHandle(),
|
||||||
logError,
|
logError,
|
||||||
cb
|
cb
|
||||||
);
|
);
|
||||||
|
@ -72,6 +73,29 @@ var NavigatorTransitionerIOS = React.createClass({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
type Route = {
|
||||||
|
component: Function;
|
||||||
|
title: string;
|
||||||
|
passProps: Object;
|
||||||
|
backButtonTitle: string;
|
||||||
|
rightButtonTitle: string;
|
||||||
|
onRightButtonPress: Function;
|
||||||
|
wrapperStyle: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
type State = {
|
||||||
|
idStack: Array<number>;
|
||||||
|
routeStack: Array<Route>;
|
||||||
|
requestedTopOfStack: number;
|
||||||
|
observedTopOfStack: number;
|
||||||
|
progress: number;
|
||||||
|
fromIndex: number;
|
||||||
|
toIndex: number;
|
||||||
|
makingNavigatorRequest: boolean;
|
||||||
|
updatingAllIndicesAtOrBeyond: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Think of `<NavigatorIOS>` as simply a component that renders an
|
* Think of `<NavigatorIOS>` as simply a component that renders an
|
||||||
|
@ -224,6 +248,8 @@ var NavigatorIOS = React.createClass({
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
navigator: (undefined: ?Object),
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
// Precompute a pack of callbacks that's frequently generated and passed to
|
// Precompute a pack of callbacks that's frequently generated and passed to
|
||||||
// instances.
|
// instances.
|
||||||
|
@ -240,7 +266,7 @@ var NavigatorIOS = React.createClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function(): State {
|
||||||
return {
|
return {
|
||||||
idStack: [getuid()],
|
idStack: [getuid()],
|
||||||
routeStack: [this.props.initialRoute],
|
routeStack: [this.props.initialRoute],
|
||||||
|
@ -266,7 +292,9 @@ var NavigatorIOS = React.createClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleFocusRequest: function(item) {
|
_toFocusOnNavigationComplete: (undefined: any),
|
||||||
|
|
||||||
|
_handleFocusRequest: function(item: any) {
|
||||||
if (this.state.makingNavigatorRequest) {
|
if (this.state.makingNavigatorRequest) {
|
||||||
this._toFocusOnNavigationComplete = item;
|
this._toFocusOnNavigationComplete = item;
|
||||||
} else {
|
} else {
|
||||||
|
@ -274,14 +302,22 @@ var NavigatorIOS = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFocusEmitter: function() {
|
_focusEmitter: (undefined: ?EventEmitter),
|
||||||
if (!this._focusEmitter) {
|
|
||||||
this._focusEmitter = new EventEmitter();
|
_getFocusEmitter: function(): EventEmitter {
|
||||||
|
// Flow not yet tracking assignments to instance fields.
|
||||||
|
var focusEmitter = this._focusEmitter;
|
||||||
|
if (!focusEmitter) {
|
||||||
|
focusEmitter = new EventEmitter();
|
||||||
|
this._focusEmitter = focusEmitter;
|
||||||
}
|
}
|
||||||
return this._focusEmitter;
|
return focusEmitter;
|
||||||
},
|
},
|
||||||
|
|
||||||
getChildContext: function() {
|
getChildContext: function(): {
|
||||||
|
onFocusRequested: Function;
|
||||||
|
focusEmitter: EventEmitter;
|
||||||
|
} {
|
||||||
return {
|
return {
|
||||||
onFocusRequested: this._handleFocusRequest,
|
onFocusRequested: this._handleFocusRequest,
|
||||||
focusEmitter: this._getFocusEmitter(),
|
focusEmitter: this._getFocusEmitter(),
|
||||||
|
@ -293,13 +329,13 @@ var NavigatorIOS = React.createClass({
|
||||||
focusEmitter: React.PropTypes.instanceOf(EventEmitter),
|
focusEmitter: React.PropTypes.instanceOf(EventEmitter),
|
||||||
},
|
},
|
||||||
|
|
||||||
_tryLockNavigator: function(cb) {
|
_tryLockNavigator: function(cb: () => void) {
|
||||||
this.refs[TRANSITIONER_REF].requestSchedulingNavigation(
|
this.refs[TRANSITIONER_REF].requestSchedulingNavigation(
|
||||||
(acquiredLock) => acquiredLock && cb()
|
(acquiredLock) => acquiredLock && cb()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleNavigatorStackChanged: function(e) {
|
_handleNavigatorStackChanged: function(e: Event) {
|
||||||
var newObservedTopOfStack = e.nativeEvent.stackLength - 1;
|
var newObservedTopOfStack = e.nativeEvent.stackLength - 1;
|
||||||
invariant(
|
invariant(
|
||||||
newObservedTopOfStack <= this.state.requestedTopOfStack,
|
newObservedTopOfStack <= this.state.requestedTopOfStack,
|
||||||
|
@ -352,7 +388,7 @@ var NavigatorIOS = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
push: function(route) {
|
push: function(route: Route) {
|
||||||
invariant(!!route, 'Must supply route to push');
|
invariant(!!route, 'Must supply route to push');
|
||||||
// Make sure all previous requests are caught up first. Otherwise reject.
|
// Make sure all previous requests are caught up first. Otherwise reject.
|
||||||
if (this.state.requestedTopOfStack === this.state.observedTopOfStack) {
|
if (this.state.requestedTopOfStack === this.state.observedTopOfStack) {
|
||||||
|
@ -372,7 +408,7 @@ var NavigatorIOS = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
popN: function(n) {
|
popN: function(n: number) {
|
||||||
if (n === 0) {
|
if (n === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +442,7 @@ var NavigatorIOS = React.createClass({
|
||||||
* `index` specifies the route in the stack that should be replaced.
|
* `index` specifies the route in the stack that should be replaced.
|
||||||
* If it's negative, it counts from the back.
|
* If it's negative, it counts from the back.
|
||||||
*/
|
*/
|
||||||
replaceAtIndex: function(route, index) {
|
replaceAtIndex: function(route: Route, index: number) {
|
||||||
invariant(!!route, 'Must supply route to replace');
|
invariant(!!route, 'Must supply route to replace');
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index += this.state.routeStack.length;
|
index += this.state.routeStack.length;
|
||||||
|
@ -434,14 +470,14 @@ var NavigatorIOS = React.createClass({
|
||||||
/**
|
/**
|
||||||
* Replaces the top of the navigation stack.
|
* Replaces the top of the navigation stack.
|
||||||
*/
|
*/
|
||||||
replace: function(route) {
|
replace: function(route: Route) {
|
||||||
this.replaceAtIndex(route, -1);
|
this.replaceAtIndex(route, -1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the current route's parent.
|
* Replace the current route's parent.
|
||||||
*/
|
*/
|
||||||
replacePrevious: function(route) {
|
replacePrevious: function(route: Route) {
|
||||||
this.replaceAtIndex(route, -2);
|
this.replaceAtIndex(route, -2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -449,7 +485,7 @@ var NavigatorIOS = React.createClass({
|
||||||
this.popToRoute(this.state.routeStack[0]);
|
this.popToRoute(this.state.routeStack[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
popToRoute: function(route) {
|
popToRoute: function(route: Route) {
|
||||||
var indexOfRoute = this.state.routeStack.indexOf(route);
|
var indexOfRoute = this.state.routeStack.indexOf(route);
|
||||||
invariant(
|
invariant(
|
||||||
indexOfRoute !== -1,
|
indexOfRoute !== -1,
|
||||||
|
@ -459,7 +495,7 @@ var NavigatorIOS = React.createClass({
|
||||||
this.popN(numToPop);
|
this.popN(numToPop);
|
||||||
},
|
},
|
||||||
|
|
||||||
replacePreviousAndPop: function(route) {
|
replacePreviousAndPop: function(route: Route) {
|
||||||
// Make sure all previous requests are caught up first. Otherwise reject.
|
// Make sure all previous requests are caught up first. Otherwise reject.
|
||||||
if (this.state.requestedTopOfStack !== this.state.observedTopOfStack) {
|
if (this.state.requestedTopOfStack !== this.state.observedTopOfStack) {
|
||||||
return;
|
return;
|
||||||
|
@ -476,7 +512,7 @@ var NavigatorIOS = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
resetTo: function(route) {
|
resetTo: function(route: Route) {
|
||||||
invariant(!!route, 'Must supply route to push');
|
invariant(!!route, 'Must supply route to push');
|
||||||
// Make sure all previous requests are caught up first. Otherwise reject.
|
// Make sure all previous requests are caught up first. Otherwise reject.
|
||||||
if (this.state.requestedTopOfStack !== this.state.observedTopOfStack) {
|
if (this.state.requestedTopOfStack !== this.state.observedTopOfStack) {
|
||||||
|
@ -486,7 +522,7 @@ var NavigatorIOS = React.createClass({
|
||||||
this.popToRoute(route);
|
this.popToRoute(route);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNavigationComplete: function(e) {
|
handleNavigationComplete: function(e: Event) {
|
||||||
if (this._toFocusOnNavigationComplete) {
|
if (this._toFocusOnNavigationComplete) {
|
||||||
this._getFocusEmitter().emit('focus', this._toFocusOnNavigationComplete);
|
this._getFocusEmitter().emit('focus', this._toFocusOnNavigationComplete);
|
||||||
this._toFocusOnNavigationComplete = null;
|
this._toFocusOnNavigationComplete = null;
|
||||||
|
@ -494,7 +530,7 @@ var NavigatorIOS = React.createClass({
|
||||||
this._handleNavigatorStackChanged(e);
|
this._handleNavigatorStackChanged(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_routeToStackItem: function(route, i) {
|
_routeToStackItem: function(route: Route, i: number) {
|
||||||
var Component = route.component;
|
var Component = route.component;
|
||||||
var shouldUpdateChild = this.state.updatingAllIndicesAtOrBeyond !== null &&
|
var shouldUpdateChild = this.state.updatingAllIndicesAtOrBeyond !== null &&
|
||||||
this.state.updatingAllIndicesAtOrBeyond >= i;
|
this.state.updatingAllIndicesAtOrBeyond >= i;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ScrollResponder
|
* @providesModule ScrollResponder
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -102,10 +103,19 @@ var warning = require('warning');
|
||||||
|
|
||||||
var IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
|
var IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
|
||||||
|
|
||||||
|
type State = {
|
||||||
|
isTouching: boolean;
|
||||||
|
lastMomentumScrollBeginTime: number;
|
||||||
|
lastMomentumScrollEndTime: number;
|
||||||
|
observedScrollSinceBecomingResponder: boolean;
|
||||||
|
becameResponderWhileAnimating: boolean;
|
||||||
|
};
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
var ScrollResponderMixin = {
|
var ScrollResponderMixin = {
|
||||||
mixins: [Subscribable.Mixin],
|
mixins: [Subscribable.Mixin],
|
||||||
statics: RCTScrollViewConsts,
|
statics: RCTScrollViewConsts,
|
||||||
scrollResponderMixinGetInitialState: function() {
|
scrollResponderMixinGetInitialState: function(): State {
|
||||||
return {
|
return {
|
||||||
isTouching: false,
|
isTouching: false,
|
||||||
lastMomentumScrollBeginTime: 0,
|
lastMomentumScrollBeginTime: 0,
|
||||||
|
@ -124,7 +134,7 @@ var ScrollResponderMixin = {
|
||||||
/**
|
/**
|
||||||
* Invoke this from an `onScroll` event.
|
* Invoke this from an `onScroll` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleScrollShouldSetResponder: function() {
|
scrollResponderHandleScrollShouldSetResponder: function(): boolean {
|
||||||
return this.state.isTouching;
|
return this.state.isTouching;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -153,7 +163,7 @@ var ScrollResponderMixin = {
|
||||||
* true.
|
* true.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleStartShouldSetResponder: function() {
|
scrollResponderHandleStartShouldSetResponder: function(): boolean {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -168,7 +178,7 @@ var ScrollResponderMixin = {
|
||||||
*
|
*
|
||||||
* Invoke this from an `onStartShouldSetResponderCapture` event.
|
* Invoke this from an `onStartShouldSetResponderCapture` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleStartShouldSetResponderCapture: function(e) {
|
scrollResponderHandleStartShouldSetResponderCapture: function(e: Event): boolean {
|
||||||
// First see if we want to eat taps while the keyboard is up
|
// First see if we want to eat taps while the keyboard is up
|
||||||
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
|
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
|
||||||
if (!this.props.keyboardShouldPersistTaps &&
|
if (!this.props.keyboardShouldPersistTaps &&
|
||||||
|
@ -208,7 +218,7 @@ var ScrollResponderMixin = {
|
||||||
* navigation of a swipe gesture higher in the view hierarchy, should be
|
* navigation of a swipe gesture higher in the view hierarchy, should be
|
||||||
* rejected.
|
* rejected.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleTerminationRequest: function() {
|
scrollResponderHandleTerminationRequest: function(): boolean {
|
||||||
return !this.state.observedScrollSinceBecomingResponder;
|
return !this.state.observedScrollSinceBecomingResponder;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -217,7 +227,7 @@ var ScrollResponderMixin = {
|
||||||
*
|
*
|
||||||
* @param {SyntheticEvent} e Event.
|
* @param {SyntheticEvent} e Event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleTouchEnd: function(e) {
|
scrollResponderHandleTouchEnd: function(e: Event) {
|
||||||
var nativeEvent = e.nativeEvent;
|
var nativeEvent = e.nativeEvent;
|
||||||
this.state.isTouching = nativeEvent.touches.length !== 0;
|
this.state.isTouching = nativeEvent.touches.length !== 0;
|
||||||
this.props.onTouchEnd && this.props.onTouchEnd(e);
|
this.props.onTouchEnd && this.props.onTouchEnd(e);
|
||||||
|
@ -226,7 +236,7 @@ var ScrollResponderMixin = {
|
||||||
/**
|
/**
|
||||||
* Invoke this from an `onResponderRelease` event.
|
* Invoke this from an `onResponderRelease` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleResponderRelease: function(e) {
|
scrollResponderHandleResponderRelease: function(e: Event) {
|
||||||
this.props.onResponderRelease && this.props.onResponderRelease(e);
|
this.props.onResponderRelease && this.props.onResponderRelease(e);
|
||||||
|
|
||||||
// By default scroll views will unfocus a textField
|
// By default scroll views will unfocus a textField
|
||||||
|
@ -243,7 +253,7 @@ var ScrollResponderMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollResponderHandleScroll: function(e) {
|
scrollResponderHandleScroll: function(e: Event) {
|
||||||
this.state.observedScrollSinceBecomingResponder = true;
|
this.state.observedScrollSinceBecomingResponder = true;
|
||||||
this.props.onScroll && this.props.onScroll(e);
|
this.props.onScroll && this.props.onScroll(e);
|
||||||
},
|
},
|
||||||
|
@ -251,7 +261,7 @@ var ScrollResponderMixin = {
|
||||||
/**
|
/**
|
||||||
* Invoke this from an `onResponderGrant` event.
|
* Invoke this from an `onResponderGrant` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleResponderGrant: function(e) {
|
scrollResponderHandleResponderGrant: function(e: Event) {
|
||||||
this.state.observedScrollSinceBecomingResponder = false;
|
this.state.observedScrollSinceBecomingResponder = false;
|
||||||
this.props.onResponderGrant && this.props.onResponderGrant(e);
|
this.props.onResponderGrant && this.props.onResponderGrant(e);
|
||||||
this.state.becameResponderWhileAnimating = this.scrollResponderIsAnimating();
|
this.state.becameResponderWhileAnimating = this.scrollResponderIsAnimating();
|
||||||
|
@ -264,21 +274,21 @@ var ScrollResponderMixin = {
|
||||||
*
|
*
|
||||||
* Invoke this from an `onScrollBeginDrag` event.
|
* Invoke this from an `onScrollBeginDrag` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleScrollBeginDrag: function(e) {
|
scrollResponderHandleScrollBeginDrag: function(e: Event) {
|
||||||
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag(e);
|
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke this from an `onScrollEndDrag` event.
|
* Invoke this from an `onScrollEndDrag` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleScrollEndDrag: function(e) {
|
scrollResponderHandleScrollEndDrag: function(e: Event) {
|
||||||
this.props.onScrollEndDrag && this.props.onScrollEndDrag(e);
|
this.props.onScrollEndDrag && this.props.onScrollEndDrag(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke this from an `onMomentumScrollBegin` event.
|
* Invoke this from an `onMomentumScrollBegin` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleMomentumScrollBegin: function(e) {
|
scrollResponderHandleMomentumScrollBegin: function(e: Event) {
|
||||||
this.state.lastMomentumScrollBeginTime = Date.now();
|
this.state.lastMomentumScrollBeginTime = Date.now();
|
||||||
this.props.onMomentumScrollBegin && this.props.onMomentumScrollBegin(e);
|
this.props.onMomentumScrollBegin && this.props.onMomentumScrollBegin(e);
|
||||||
},
|
},
|
||||||
|
@ -286,7 +296,7 @@ var ScrollResponderMixin = {
|
||||||
/**
|
/**
|
||||||
* Invoke this from an `onMomentumScrollEnd` event.
|
* Invoke this from an `onMomentumScrollEnd` event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleMomentumScrollEnd: function(e) {
|
scrollResponderHandleMomentumScrollEnd: function(e: Event) {
|
||||||
this.state.lastMomentumScrollEndTime = Date.now();
|
this.state.lastMomentumScrollEndTime = Date.now();
|
||||||
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd(e);
|
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd(e);
|
||||||
},
|
},
|
||||||
|
@ -302,7 +312,7 @@ var ScrollResponderMixin = {
|
||||||
*
|
*
|
||||||
* @param {SyntheticEvent} e Touch Start event.
|
* @param {SyntheticEvent} e Touch Start event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleTouchStart: function(e) {
|
scrollResponderHandleTouchStart: function(e: Event) {
|
||||||
this.state.isTouching = true;
|
this.state.isTouching = true;
|
||||||
this.props.onTouchStart && this.props.onTouchStart(e);
|
this.props.onTouchStart && this.props.onTouchStart(e);
|
||||||
},
|
},
|
||||||
|
@ -318,7 +328,7 @@ var ScrollResponderMixin = {
|
||||||
*
|
*
|
||||||
* @param {SyntheticEvent} e Touch Start event.
|
* @param {SyntheticEvent} e Touch Start event.
|
||||||
*/
|
*/
|
||||||
scrollResponderHandleTouchMove: function(e) {
|
scrollResponderHandleTouchMove: function(e: Event) {
|
||||||
this.props.onTouchMove && this.props.onTouchMove(e);
|
this.props.onTouchMove && this.props.onTouchMove(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -327,7 +337,7 @@ var ScrollResponderMixin = {
|
||||||
* view is currently animating. This is particularly useful to know when
|
* view is currently animating. This is particularly useful to know when
|
||||||
* a touch has just started or ended.
|
* a touch has just started or ended.
|
||||||
*/
|
*/
|
||||||
scrollResponderIsAnimating: function() {
|
scrollResponderIsAnimating: function(): boolean {
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var timeSinceLastMomentumScrollEnd = now - this.state.lastMomentumScrollEndTime;
|
var timeSinceLastMomentumScrollEnd = now - this.state.lastMomentumScrollEndTime;
|
||||||
var isAnimating = timeSinceLastMomentumScrollEnd < IS_ANIMATING_TOUCH_START_THRESHOLD_MS ||
|
var isAnimating = timeSinceLastMomentumScrollEnd < IS_ANIMATING_TOUCH_START_THRESHOLD_MS ||
|
||||||
|
@ -340,7 +350,7 @@ var ScrollResponderMixin = {
|
||||||
* This is currently used to help focus on child textview's, but this
|
* This is currently used to help focus on child textview's, but this
|
||||||
* can also be used to quickly scroll to any element we want to focus
|
* can also be used to quickly scroll to any element we want to focus
|
||||||
*/
|
*/
|
||||||
scrollResponderScrollTo: function(offsetX, offsetY) {
|
scrollResponderScrollTo: function(offsetX: number, offsetY: number) {
|
||||||
RCTUIManagerDeprecated.scrollTo(this.getNodeHandle(), offsetX, offsetY);
|
RCTUIManagerDeprecated.scrollTo(this.getNodeHandle(), offsetX, offsetY);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -348,7 +358,7 @@ var ScrollResponderMixin = {
|
||||||
* A helper function to zoom to a specific rect in the scrollview.
|
* A helper function to zoom to a specific rect in the scrollview.
|
||||||
* @param {object} rect Should have shape {x, y, w, h}
|
* @param {object} rect Should have shape {x, y, w, h}
|
||||||
*/
|
*/
|
||||||
scrollResponderZoomTo: function(rect) {
|
scrollResponderZoomTo: function(rect: { x: number; y: number; w: number; h: number; }) {
|
||||||
RCTUIManagerDeprecated.zoomToRect(this.getNodeHandle(), rect);
|
RCTUIManagerDeprecated.zoomToRect(this.getNodeHandle(), rect);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -357,7 +367,7 @@ var ScrollResponderMixin = {
|
||||||
* parent view. Note that any module using this mixin needs to return
|
* parent view. Note that any module using this mixin needs to return
|
||||||
* the parent view's ref in getScrollViewRef() in order to use this method
|
* the parent view's ref in getScrollViewRef() in order to use this method
|
||||||
*/
|
*/
|
||||||
scrollResponderScrollNativeHandleToKeyboard: function(nodeHandle, additionalOffset) {
|
scrollResponderScrollNativeHandleToKeyboard: function(nodeHandle: any, additionalOffset?: number) {
|
||||||
this.additionalScrollOffset = additionalOffset || 0;
|
this.additionalScrollOffset = additionalOffset || 0;
|
||||||
RCTUIManager.measureLayout(
|
RCTUIManager.measureLayout(
|
||||||
nodeHandle,
|
nodeHandle,
|
||||||
|
@ -377,7 +387,7 @@ var ScrollResponderMixin = {
|
||||||
* @param {number} width Width of the text input.
|
* @param {number} width Width of the text input.
|
||||||
* @param {number} height Height of the text input.
|
* @param {number} height Height of the text input.
|
||||||
*/
|
*/
|
||||||
scrollResponderInputMeasureAndScrollToKeyboard: function(left, top, width, height) {
|
scrollResponderInputMeasureAndScrollToKeyboard: function(left: number, top: number, width: number, height: number) {
|
||||||
if (this.keyboardWillOpenTo) {
|
if (this.keyboardWillOpenTo) {
|
||||||
var scrollOffsetY =
|
var scrollOffsetY =
|
||||||
top - this.keyboardWillOpenTo.endCoordinates.screenY + height +
|
top - this.keyboardWillOpenTo.endCoordinates.screenY + height +
|
||||||
|
@ -387,7 +397,7 @@ var ScrollResponderMixin = {
|
||||||
this.additionalOffset = 0;
|
this.additionalOffset = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollResponderTextInputFocusError: function(e) {
|
scrollResponderTextInputFocusError: function(e: Event) {
|
||||||
console.error('Error measuring text field: ', e);
|
console.error('Error measuring text field: ', e);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -434,12 +444,12 @@ var ScrollResponderMixin = {
|
||||||
* relevant to you. (For example, only if you receive these callbacks after
|
* relevant to you. (For example, only if you receive these callbacks after
|
||||||
* you had explicitly focused a node etc).
|
* you had explicitly focused a node etc).
|
||||||
*/
|
*/
|
||||||
scrollResponderKeyboardWillShow: function(e) {
|
scrollResponderKeyboardWillShow: function(e: Event) {
|
||||||
this.keyboardWillOpenTo = e;
|
this.keyboardWillOpenTo = e;
|
||||||
this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e);
|
this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollResponderKeyboardWillHide: function(e) {
|
scrollResponderKeyboardWillHide: function(e: Event) {
|
||||||
this.keyboardWillOpenTo = null;
|
this.keyboardWillOpenTo = null;
|
||||||
this.props.onKeyboardWillHide && this.props.onKeyboardWillHide(e);
|
this.props.onKeyboardWillHide && this.props.onKeyboardWillHide(e);
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ScrollView
|
* @providesModule ScrollView
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -178,15 +179,15 @@ var ScrollView = React.createClass({
|
||||||
return this.scrollResponderMixinGetInitialState();
|
return this.scrollResponderMixinGetInitialState();
|
||||||
},
|
},
|
||||||
|
|
||||||
setNativeProps: function(props) {
|
setNativeProps: function(props: Object) {
|
||||||
this.refs[SCROLLVIEW].setNativeProps(props);
|
this.refs[SCROLLVIEW].setNativeProps(props);
|
||||||
},
|
},
|
||||||
|
|
||||||
getInnerViewNode: function() {
|
getInnerViewNode: function(): any {
|
||||||
return this.refs[INNERVIEW].getNodeHandle();
|
return this.refs[INNERVIEW].getNodeHandle();
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollTo: function(destY, destX) {
|
scrollTo: function(destY?: number, destX?: number) {
|
||||||
RCTUIManager.scrollTo(
|
RCTUIManager.scrollTo(
|
||||||
this.getNodeHandle(),
|
this.getNodeHandle(),
|
||||||
destX || 0,
|
destX || 0,
|
||||||
|
@ -202,7 +203,7 @@ var ScrollView = React.createClass({
|
||||||
if (__DEV__ && this.props.style) {
|
if (__DEV__ && this.props.style) {
|
||||||
var style = flattenStyle(this.props.style);
|
var style = flattenStyle(this.props.style);
|
||||||
var childLayoutProps = ['alignItems', 'justifyContent']
|
var childLayoutProps = ['alignItems', 'justifyContent']
|
||||||
.filter((prop) => style[prop] !== undefined);
|
.filter((prop) => style && style[prop] !== undefined);
|
||||||
invariant(
|
invariant(
|
||||||
childLayoutProps.length === 0,
|
childLayoutProps.length === 0,
|
||||||
'ScrollView child layout (' + JSON.stringify(childLayoutProps) +
|
'ScrollView child layout (' + JSON.stringify(childLayoutProps) +
|
||||||
|
@ -250,7 +251,7 @@ var ScrollView = React.createClass({
|
||||||
keyboardDismissMode: this.props.keyboardDismissMode ?
|
keyboardDismissMode: this.props.keyboardDismissMode ?
|
||||||
keyboardDismissModeConstants[this.props.keyboardDismissMode] :
|
keyboardDismissModeConstants[this.props.keyboardDismissMode] :
|
||||||
undefined,
|
undefined,
|
||||||
style: [styles.base, this.props.style],
|
style: ([styles.base, this.props.style]: ?Array<any>),
|
||||||
onTouchStart: this.scrollResponderHandleTouchStart,
|
onTouchStart: this.scrollResponderHandleTouchStart,
|
||||||
onTouchMove: this.scrollResponderHandleTouchMove,
|
onTouchMove: this.scrollResponderHandleTouchMove,
|
||||||
onTouchEnd: this.scrollResponderHandleTouchEnd,
|
onTouchEnd: this.scrollResponderHandleTouchEnd,
|
||||||
|
@ -279,6 +280,10 @@ var ScrollView = React.createClass({
|
||||||
ScrollViewClass = AndroidScrollView;
|
ScrollViewClass = AndroidScrollView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
invariant(
|
||||||
|
ScrollViewClass !== undefined,
|
||||||
|
'ScrollViewClass must not be undefined'
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollViewClass {...props} ref={SCROLLVIEW}>
|
<ScrollViewClass {...props} ref={SCROLLVIEW}>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule SliderIOS
|
* @providesModule SliderIOS
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ var createReactIOSNativeComponentClass =
|
||||||
require('createReactIOSNativeComponentClass');
|
require('createReactIOSNativeComponentClass');
|
||||||
var merge = require('merge');
|
var merge = require('merge');
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
var SliderIOS = React.createClass({
|
var SliderIOS = React.createClass({
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
||||||
|
@ -52,7 +55,7 @@ var SliderIOS = React.createClass({
|
||||||
onSlidingComplete: PropTypes.func,
|
onSlidingComplete: PropTypes.func,
|
||||||
},
|
},
|
||||||
|
|
||||||
_onValueChange: function(event) {
|
_onValueChange: function(event: Event) {
|
||||||
this.props.onChange && this.props.onChange(event);
|
this.props.onChange && this.props.onChange(event);
|
||||||
if (event.nativeEvent.continuous) {
|
if (event.nativeEvent.continuous) {
|
||||||
this.props.onValueChange &&
|
this.props.onValueChange &&
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @provides StaticRenderer
|
* @provides StaticRenderer
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -18,11 +19,11 @@ var StaticRenderer = React.createClass({
|
||||||
render: React.PropTypes.func.isRequired,
|
render: React.PropTypes.func.isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldComponentUpdate: function(nextProps) {
|
shouldComponentUpdate: function(nextProps: { shouldUpdate: boolean }): boolean {
|
||||||
return nextProps.shouldUpdate;
|
return nextProps.shouldUpdate;
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function(): ReactElement {
|
||||||
return this.props.render();
|
return this.props.render();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule Subscribable
|
* @providesModule Subscribable
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -73,8 +74,13 @@ var logError = require('logError');
|
||||||
|
|
||||||
var SUBSCRIBABLE_INTERNAL_EVENT = 'subscriptionEvent';
|
var SUBSCRIBABLE_INTERNAL_EVENT = 'subscriptionEvent';
|
||||||
|
|
||||||
|
type Data = Object;
|
||||||
|
type EventMapping = (_: Data) => Data;
|
||||||
|
|
||||||
class Subscribable {
|
class Subscribable {
|
||||||
|
_eventMapping: EventMapping;
|
||||||
|
_lastData: Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Subscribable object
|
* Creates a new Subscribable object
|
||||||
*
|
*
|
||||||
|
@ -88,7 +94,7 @@ class Subscribable {
|
||||||
* The resolved data will be transformed with the eventMapping before it
|
* The resolved data will be transformed with the eventMapping before it
|
||||||
* gets emitted.
|
* gets emitted.
|
||||||
*/
|
*/
|
||||||
constructor(eventEmitter, eventName, eventMapping, getInitData) {
|
constructor(eventEmitter: EventEmitter, eventName: string, eventMapping?: EventMapping, getInitData?: Function) {
|
||||||
|
|
||||||
this._internalEmitter = new EventEmitter();
|
this._internalEmitter = new EventEmitter();
|
||||||
this._eventMapping = eventMapping || (data => data);
|
this._eventMapping = eventMapping || (data => data);
|
||||||
|
@ -106,7 +112,7 @@ class Subscribable {
|
||||||
/**
|
/**
|
||||||
* Returns the last data emitted from the Subscribable, or undefined
|
* Returns the last data emitted from the Subscribable, or undefined
|
||||||
*/
|
*/
|
||||||
get() {
|
get(): Data {
|
||||||
return this._lastData;
|
return this._lastData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +144,7 @@ class Subscribable {
|
||||||
* }
|
* }
|
||||||
* Call `remove` to terminate the subscription before unmounting
|
* Call `remove` to terminate the subscription before unmounting
|
||||||
*/
|
*/
|
||||||
subscribe(lifespan, callback, context) {
|
subscribe(lifespan: { addUnmountCallback: Function }, callback: Function, context: Object) {
|
||||||
invariant(
|
invariant(
|
||||||
typeof lifespan.addUnmountCallback === 'function',
|
typeof lifespan.addUnmountCallback === 'function',
|
||||||
'Must provide a valid lifespan, which provides a way to add a ' +
|
'Must provide a valid lifespan, which provides a way to add a ' +
|
||||||
|
@ -169,7 +175,7 @@ class Subscribable {
|
||||||
* Callback for the initial data resolution. Currently behaves the same as
|
* Callback for the initial data resolution. Currently behaves the same as
|
||||||
* `_handleEmit`, but we may eventually want to keep track of the difference
|
* `_handleEmit`, but we may eventually want to keep track of the difference
|
||||||
*/
|
*/
|
||||||
_handleInitData(dataInput) {
|
_handleInitData(dataInput: Data) {
|
||||||
var emitData = this._eventMapping(dataInput);
|
var emitData = this._eventMapping(dataInput);
|
||||||
this._lastData = emitData;
|
this._lastData = emitData;
|
||||||
this._internalEmitter.emit(SUBSCRIBABLE_INTERNAL_EVENT, emitData);
|
this._internalEmitter.emit(SUBSCRIBABLE_INTERNAL_EVENT, emitData);
|
||||||
|
@ -179,7 +185,7 @@ class Subscribable {
|
||||||
* Handle new data emissions. Pass the data through our eventMapping
|
* Handle new data emissions. Pass the data through our eventMapping
|
||||||
* transformation, store it for later `get()`ing, and emit it for subscribers
|
* transformation, store it for later `get()`ing, and emit it for subscribers
|
||||||
*/
|
*/
|
||||||
_handleEmit(dataInput) {
|
_handleEmit(dataInput: Data) {
|
||||||
var emitData = this._eventMapping(dataInput);
|
var emitData = this._eventMapping(dataInput);
|
||||||
this._lastData = emitData;
|
this._lastData = emitData;
|
||||||
this._internalEmitter.emit(SUBSCRIBABLE_INTERNAL_EVENT, emitData);
|
this._internalEmitter.emit(SUBSCRIBABLE_INTERNAL_EVENT, emitData);
|
||||||
|
@ -280,12 +286,13 @@ Subscribable.Mixin = {
|
||||||
if (!this._localSubscribables) {
|
if (!this._localSubscribables) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var emitterSubscribables;
|
|
||||||
Object.keys(this._localSubscribables).forEach((eventEmitter) => {
|
Object.keys(this._localSubscribables).forEach((eventEmitter) => {
|
||||||
emitterSubscribables = this._localSubscribables[eventEmitter];
|
var emitterSubscribables = this._localSubscribables[eventEmitter];
|
||||||
|
if (emitterSubscribables) {
|
||||||
Object.keys(emitterSubscribables).forEach((eventName) => {
|
Object.keys(emitterSubscribables).forEach((eventName) => {
|
||||||
emitterSubscribables[eventName].cleanup();
|
emitterSubscribables[eventName].cleanup();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this._localSubscribables = null;
|
this._localSubscribables = null;
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule SwitchIOS
|
* @providesModule SwitchIOS
|
||||||
|
* @flow
|
||||||
*
|
*
|
||||||
* This is a controlled component version of RCTSwitch.
|
* This is a controlled component version of RCTSwitch.
|
||||||
*/
|
*/
|
||||||
|
@ -23,6 +24,13 @@ var merge = require('merge');
|
||||||
|
|
||||||
var SWITCH = 'switch';
|
var SWITCH = 'switch';
|
||||||
|
|
||||||
|
type DefaultProps = {
|
||||||
|
value: boolean;
|
||||||
|
disabled: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use `SwitchIOS` to render a boolean input on iOS. This is
|
* Use `SwitchIOS` to render a boolean input on iOS. This is
|
||||||
* a controlled component, so you must hook in to the `onValueChange` callback
|
* a controlled component, so you must hook in to the `onValueChange` callback
|
||||||
|
@ -67,14 +75,14 @@ var SwitchIOS = React.createClass({
|
||||||
tintColor: PropTypes.string,
|
tintColor: PropTypes.string,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function(): DefaultProps {
|
||||||
return {
|
return {
|
||||||
value: false,
|
value: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChange: function(event) {
|
_onChange: function(event: Event) {
|
||||||
this.props.onChange && this.props.onChange(event);
|
this.props.onChange && this.props.onChange(event);
|
||||||
this.props.onValueChange && this.props.onValueChange(event.nativeEvent.value);
|
this.props.onValueChange && this.props.onValueChange(event.nativeEvent.value);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule TabBarIOS
|
* @providesModule TabBarIOS
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule TabBarItemIOS
|
* @providesModule TabBarItemIOS
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ var TabBarItemIOS = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
componentWillReceiveProps: function(nextProps: { selected: boolean }) {
|
||||||
if (this.state.hasBeenSelected || nextProps.selected) {
|
if (this.state.hasBeenSelected || nextProps.selected) {
|
||||||
this.setState({hasBeenSelected: true});
|
this.setState({hasBeenSelected: true});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule TextInput
|
* @providesModule TextInput
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -63,6 +64,12 @@ var notMultiline = {
|
||||||
onSubmitEditing: true,
|
onSubmitEditing: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type DefaultProps = {
|
||||||
|
bufferDelay: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A foundational component for inputting text into the app via a
|
* A foundational component for inputting text into the app via a
|
||||||
* keyboard. Props provide configurability for several features, such as auto-
|
* keyboard. Props provide configurability for several features, such as auto-
|
||||||
|
@ -206,12 +213,12 @@ var TextInput = React.createClass({
|
||||||
validAttributes: RCTTextFieldAttributes,
|
validAttributes: RCTTextFieldAttributes,
|
||||||
},
|
},
|
||||||
|
|
||||||
isFocused: function() {
|
isFocused: function(): boolean {
|
||||||
return TextInputState.currentlyFocusedField() ===
|
return TextInputState.currentlyFocusedField() ===
|
||||||
this.refs.input.getNativeNode();
|
this.refs.input.getNativeNode();
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function(): DefaultProps {
|
||||||
return {
|
return {
|
||||||
bufferDelay: 100,
|
bufferDelay: 100,
|
||||||
};
|
};
|
||||||
|
@ -229,6 +236,8 @@ var TextInput = React.createClass({
|
||||||
focusEmitter: React.PropTypes.instanceOf(EventEmitter),
|
focusEmitter: React.PropTypes.instanceOf(EventEmitter),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_focusSubscription: (undefined: ?Function),
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
if (!this.context.focusEmitter) {
|
if (!this.context.focusEmitter) {
|
||||||
if (this.props.autoFocus) {
|
if (this.props.autoFocus) {
|
||||||
|
@ -255,7 +264,9 @@ var TextInput = React.createClass({
|
||||||
this._focusSubscription && this._focusSubscription.remove();
|
this._focusSubscription && this._focusSubscription.remove();
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
_bufferTimeout: (undefined: ?number),
|
||||||
|
|
||||||
|
componentWillReceiveProps: function(newProps: {value: any}) {
|
||||||
if (newProps.value !== this.props.value) {
|
if (newProps.value !== this.props.value) {
|
||||||
if (!this.isFocused()) {
|
if (!this.isFocused()) {
|
||||||
// Set the value immediately if the input is not focused since that
|
// Set the value immediately if the input is not focused since that
|
||||||
|
@ -385,17 +396,17 @@ var TextInput = React.createClass({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFocus: function(event) {
|
_onFocus: function(event: Event) {
|
||||||
if (this.props.onFocus) {
|
if (this.props.onFocus) {
|
||||||
this.props.onFocus(event);
|
this.props.onFocus(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPress: function(event) {
|
_onPress: function(event: Event) {
|
||||||
this.focus();
|
this.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChange: function(event) {
|
_onChange: function(event: Event) {
|
||||||
if (this.props.controlled && event.nativeEvent.text !== this.props.value) {
|
if (this.props.controlled && event.nativeEvent.text !== this.props.value) {
|
||||||
this.refs.input.setNativeProps({text: this.props.value});
|
this.refs.input.setNativeProps({text: this.props.value});
|
||||||
}
|
}
|
||||||
|
@ -403,14 +414,14 @@ var TextInput = React.createClass({
|
||||||
this.props.onChangeText && this.props.onChangeText(event.nativeEvent.text);
|
this.props.onChangeText && this.props.onChangeText(event.nativeEvent.text);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onBlur: function(event) {
|
_onBlur: function(event: Event) {
|
||||||
this.blur();
|
this.blur();
|
||||||
if (this.props.onBlur) {
|
if (this.props.onBlur) {
|
||||||
this.props.onBlur(event);
|
this.props.onBlur(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSelectionChange: function(event) {
|
_onSelectionChange: function(event: Event) {
|
||||||
if (this.props.selectionState) {
|
if (this.props.selectionState) {
|
||||||
var selection = event.nativeEvent.selection;
|
var selection = event.nativeEvent.selection;
|
||||||
this.props.selectionState.update(selection.start, selection.end);
|
this.props.selectionState.update(selection.start, selection.end);
|
||||||
|
@ -418,7 +429,7 @@ var TextInput = React.createClass({
|
||||||
this.props.onSelectionChange && this.props.onSelectionChange(event);
|
this.props.onSelectionChange && this.props.onSelectionChange(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTextInput: function(event) {
|
_onTextInput: function(event: Event) {
|
||||||
this.props.onTextInput && this.props.onTextInput(event);
|
this.props.onTextInput && this.props.onTextInput(event);
|
||||||
var counter = event.nativeEvent.eventCounter;
|
var counter = event.nativeEvent.eventCounter;
|
||||||
if (counter > this.state.mostRecentEventCounter) {
|
if (counter > this.state.mostRecentEventCounter) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule TextInputState
|
* @providesModule TextInputState
|
||||||
|
* @flow
|
||||||
*
|
*
|
||||||
* This class is responsible for coordinating the "focused"
|
* This class is responsible for coordinating the "focused"
|
||||||
* state for TextInputs. All calls relating to the keyboard
|
* state for TextInputs. All calls relating to the keyboard
|
||||||
|
@ -20,13 +21,13 @@ var TextInputState = {
|
||||||
/**
|
/**
|
||||||
* Internal state
|
* Internal state
|
||||||
*/
|
*/
|
||||||
_currentlyFocusedID: null,
|
_currentlyFocusedID: (null: ?string),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID of the currently focused text field, if one exists
|
* Returns the ID of the currently focused text field, if one exists
|
||||||
* If no text field is focused it returns null
|
* If no text field is focused it returns null
|
||||||
*/
|
*/
|
||||||
currentlyFocusedField: function() {
|
currentlyFocusedField: function(): ?string {
|
||||||
return this._currentlyFocusedID;
|
return this._currentlyFocusedID;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ var TextInputState = {
|
||||||
* Focuses the specified text field
|
* Focuses the specified text field
|
||||||
* noop if the text field was already focused
|
* noop if the text field was already focused
|
||||||
*/
|
*/
|
||||||
focusTextInput: function(textFieldID) {
|
focusTextInput: function(textFieldID: string) {
|
||||||
if (this._currentlyFocusedID != textFieldID && textFieldID != null) {
|
if (this._currentlyFocusedID != textFieldID && textFieldID != null) {
|
||||||
this._currentlyFocusedID = textFieldID;
|
this._currentlyFocusedID = textFieldID;
|
||||||
RCTUIManager.focus(textFieldID);
|
RCTUIManager.focus(textFieldID);
|
||||||
|
@ -47,7 +48,7 @@ var TextInputState = {
|
||||||
* Unfocuses the specified text field
|
* Unfocuses the specified text field
|
||||||
* noop if it wasn't focused
|
* noop if it wasn't focused
|
||||||
*/
|
*/
|
||||||
blurTextInput: function(textFieldID) {
|
blurTextInput: function(textFieldID: string) {
|
||||||
if (this._currentlyFocusedID == textFieldID && textFieldID != null) {
|
if (this._currentlyFocusedID == textFieldID && textFieldID != null) {
|
||||||
this._currentlyFocusedID = null;
|
this._currentlyFocusedID = null;
|
||||||
RCTUIManager.blur(textFieldID);
|
RCTUIManager.blur(textFieldID);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule TouchableBounce
|
* @providesModule TouchableBounce
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -20,6 +21,10 @@ var merge = require('merge');
|
||||||
var copyProperties = require('copyProperties');
|
var copyProperties = require('copyProperties');
|
||||||
var onlyChild = require('onlyChild');
|
var onlyChild = require('onlyChild');
|
||||||
|
|
||||||
|
type State = {
|
||||||
|
animationID: ?number;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the scroll view is disabled, this defines how far your touch may move
|
* When the scroll view is disabled, this defines how far your touch may move
|
||||||
* off of the button, before deactivating the button. Once deactivated, try
|
* off of the button, before deactivating the button. Once deactivated, try
|
||||||
|
@ -47,11 +52,17 @@ var TouchableBounce = React.createClass({
|
||||||
onPressAnimationComplete: React.PropTypes.func,
|
onPressAnimationComplete: React.PropTypes.func,
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function(): State {
|
||||||
return merge(this.touchableGetInitialState(), {animationID: null});
|
return merge(this.touchableGetInitialState(), {animationID: null});
|
||||||
},
|
},
|
||||||
|
|
||||||
bounceTo: function(value, velocity, bounciness, fromValue, callback) {
|
bounceTo: function(
|
||||||
|
value: number,
|
||||||
|
velocity: number,
|
||||||
|
bounciness: number,
|
||||||
|
fromValue?: ?Function | number,
|
||||||
|
callback?: ?Function
|
||||||
|
) {
|
||||||
if (POPAnimation) {
|
if (POPAnimation) {
|
||||||
this.state.animationID && this.removeAnimation(this.state.animationID);
|
this.state.animationID && this.removeAnimation(this.state.animationID);
|
||||||
var anim = {
|
var anim = {
|
||||||
|
@ -60,6 +71,7 @@ var TouchableBounce = React.createClass({
|
||||||
toValue: [value, value],
|
toValue: [value, value],
|
||||||
velocity: [velocity, velocity],
|
velocity: [velocity, velocity],
|
||||||
springBounciness: bounciness,
|
springBounciness: bounciness,
|
||||||
|
fromValue: (undefined: ?any),
|
||||||
};
|
};
|
||||||
if (fromValue) {
|
if (fromValue) {
|
||||||
anim.fromValue = [fromValue, fromValue];
|
anim.fromValue = [fromValue, fromValue];
|
||||||
|
@ -90,8 +102,9 @@ var TouchableBounce = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
touchableHandlePress: function() {
|
touchableHandlePress: function() {
|
||||||
if (this.props.onPressWithCompletion) {
|
var onPressWithCompletion = this.props.onPressWithCompletion;
|
||||||
this.props.onPressWithCompletion(
|
if (onPressWithCompletion) {
|
||||||
|
onPressWithCompletion(
|
||||||
this.bounceTo.bind(this, 1, 10, 10, 0.93, this.props.onPressAnimationComplete)
|
this.bounceTo.bind(this, 1, 10, 10, 0.93, this.props.onPressAnimationComplete)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
@ -101,11 +114,11 @@ var TouchableBounce = React.createClass({
|
||||||
this.props.onPress && this.props.onPress();
|
this.props.onPress && this.props.onPress();
|
||||||
},
|
},
|
||||||
|
|
||||||
touchableGetPressRectOffset: function() {
|
touchableGetPressRectOffset: function(): typeof PRESS_RECT_OFFSET {
|
||||||
return PRESS_RECT_OFFSET; // Always make sure to predeclare a constant!
|
return PRESS_RECT_OFFSET; // Always make sure to predeclare a constant!
|
||||||
},
|
},
|
||||||
|
|
||||||
touchableGetHighlightDelayMS: function() {
|
touchableGetHighlightDelayMS: function(): number {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Note (avik): add @flow when Flow supports spread properties in propTypes
|
||||||
|
|
||||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||||
var React = require('React');
|
var React = require('React');
|
||||||
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Note (avik): add @flow when Flow supports spread properties in propTypes
|
||||||
|
|
||||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||||
var POPAnimationMixin = require('POPAnimationMixin');
|
var POPAnimationMixin = require('POPAnimationMixin');
|
||||||
var React = require('React');
|
var React = require('React');
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule TouchableWithoutFeedback
|
* @providesModule TouchableWithoutFeedback
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ var onlyChild = require('onlyChild');
|
||||||
*/
|
*/
|
||||||
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not use unless you have a very good reason. All the elements that
|
* Do not use unless you have a very good reason. All the elements that
|
||||||
|
@ -51,7 +53,7 @@ var TouchableWithoutFeedback = React.createClass({
|
||||||
* `Touchable.Mixin` self callbacks. The mixin will invoke these if they are
|
* `Touchable.Mixin` self callbacks. The mixin will invoke these if they are
|
||||||
* defined on your component.
|
* defined on your component.
|
||||||
*/
|
*/
|
||||||
touchableHandlePress: function(e) {
|
touchableHandlePress: function(e: Event) {
|
||||||
this.props.onPress && this.props.onPress(e);
|
this.props.onPress && this.props.onPress(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -67,18 +69,19 @@ var TouchableWithoutFeedback = React.createClass({
|
||||||
this.props.onLongPress && this.props.onLongPress();
|
this.props.onLongPress && this.props.onLongPress();
|
||||||
},
|
},
|
||||||
|
|
||||||
touchableGetPressRectOffset: function() {
|
touchableGetPressRectOffset: function(): typeof PRESS_RECT_OFFSET {
|
||||||
return PRESS_RECT_OFFSET; // Always make sure to predeclare a constant!
|
return PRESS_RECT_OFFSET; // Always make sure to predeclare a constant!
|
||||||
},
|
},
|
||||||
|
|
||||||
touchableGetHighlightDelayMS: function() {
|
touchableGetHighlightDelayMS: function(): number {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function(): ReactElement {
|
||||||
// Note(vjeux): use cloneWithProps once React has been upgraded
|
// Note(vjeux): use cloneWithProps once React has been upgraded
|
||||||
var child = onlyChild(this.props.children);
|
var child = onlyChild(this.props.children);
|
||||||
return React.cloneElement(child, {
|
// Note(avik): remove dynamic typecast once Flow has been upgraded
|
||||||
|
return (React: any).cloneElement(child, {
|
||||||
accessible: true,
|
accessible: true,
|
||||||
testID: this.props.testID,
|
testID: this.props.testID,
|
||||||
onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
|
onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
|
||||||
|
|
|
@ -7,12 +7,13 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ensureComponentIsNative
|
* @providesModule ensureComponentIsNative
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var invariant = require('invariant');
|
var invariant = require('invariant');
|
||||||
|
|
||||||
var ensureComponentIsNative = function(component) {
|
var ensureComponentIsNative = function(component: any) {
|
||||||
invariant(
|
invariant(
|
||||||
component && typeof component.setNativeProps === 'function',
|
component && typeof component.setNativeProps === 'function',
|
||||||
'Touchable child must either be native or forward setNativeProps to a ' +
|
'Touchable child must either be native or forward setNativeProps to a ' +
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule View
|
* @providesModule View
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ViewStylePropTypes
|
* @providesModule ViewStylePropTypes
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule WebView
|
* @providesModule WebView
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -24,6 +25,8 @@ var merge = require('merge');
|
||||||
var PropTypes = React.PropTypes;
|
var PropTypes = React.PropTypes;
|
||||||
var RCTWebViewManager = require('NativeModules').WebViewManager;
|
var RCTWebViewManager = require('NativeModules').WebViewManager;
|
||||||
|
|
||||||
|
var invariant = require('invariant');
|
||||||
|
|
||||||
var RCT_WEBVIEW_REF = 'webview';
|
var RCT_WEBVIEW_REF = 'webview';
|
||||||
|
|
||||||
var WebViewState = keyMirror({
|
var WebViewState = keyMirror({
|
||||||
|
@ -41,6 +44,14 @@ var NavigationType = {
|
||||||
other: RCTWebViewManager.NavigationType.Other,
|
other: RCTWebViewManager.NavigationType.Other,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ErrorEvent = {
|
||||||
|
domain: any;
|
||||||
|
code: any;
|
||||||
|
description: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Event = Object;
|
||||||
|
|
||||||
var WebView = React.createClass({
|
var WebView = React.createClass({
|
||||||
statics: {
|
statics: {
|
||||||
NavigationType: NavigationType,
|
NavigationType: NavigationType,
|
||||||
|
@ -61,7 +72,7 @@ var WebView = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
viewState: WebViewState.IDLE,
|
viewState: WebViewState.IDLE,
|
||||||
lastErrorEvent: null,
|
lastErrorEvent: (null: ?ErrorEvent),
|
||||||
startInLoadingState: true,
|
startInLoadingState: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -79,6 +90,10 @@ var WebView = React.createClass({
|
||||||
otherView = this.props.renderLoading();
|
otherView = this.props.renderLoading();
|
||||||
} else if (this.state.viewState === WebViewState.ERROR) {
|
} else if (this.state.viewState === WebViewState.ERROR) {
|
||||||
var errorEvent = this.state.lastErrorEvent;
|
var errorEvent = this.state.lastErrorEvent;
|
||||||
|
invariant(
|
||||||
|
errorEvent != null,
|
||||||
|
'lastErrorEvent expected to be non-null'
|
||||||
|
);
|
||||||
otherView = this.props.renderError(
|
otherView = this.props.renderError(
|
||||||
errorEvent.domain,
|
errorEvent.domain,
|
||||||
errorEvent.code,
|
errorEvent.code,
|
||||||
|
@ -132,21 +147,21 @@ var WebView = React.createClass({
|
||||||
* We return an event with a bunch of fields including:
|
* We return an event with a bunch of fields including:
|
||||||
* url, title, loading, canGoBack, canGoForward
|
* url, title, loading, canGoBack, canGoForward
|
||||||
*/
|
*/
|
||||||
updateNavigationState: function(event) {
|
updateNavigationState: function(event: Event) {
|
||||||
if (this.props.onNavigationStateChange) {
|
if (this.props.onNavigationStateChange) {
|
||||||
this.props.onNavigationStateChange(event.nativeEvent);
|
this.props.onNavigationStateChange(event.nativeEvent);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getWebWiewHandle: function() {
|
getWebWiewHandle: function(): any {
|
||||||
return this.refs[RCT_WEBVIEW_REF].getNodeHandle();
|
return this.refs[RCT_WEBVIEW_REF].getNodeHandle();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoadingStart: function(event) {
|
onLoadingStart: function(event: Event) {
|
||||||
this.updateNavigationState(event);
|
this.updateNavigationState(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoadingError: function(event) {
|
onLoadingError: function(event: Event) {
|
||||||
event.persist(); // persist this event because we need to store it
|
event.persist(); // persist this event because we need to store it
|
||||||
console.error("encountered an error loading page", event.nativeEvent);
|
console.error("encountered an error loading page", event.nativeEvent);
|
||||||
|
|
||||||
|
@ -156,7 +171,7 @@ var WebView = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoadingFinish: function(event) {
|
onLoadingFinish: function(event: Event) {
|
||||||
this.setState({
|
this.setState({
|
||||||
viewState: WebViewState.IDLE,
|
viewState: WebViewState.IDLE,
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule RCTDeviceEventEmitter
|
* @providesModule RCTDeviceEventEmitter
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule Geolocation
|
* @providesModule Geolocation
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -33,7 +34,10 @@ var updatesEnabled = false;
|
||||||
*/
|
*/
|
||||||
var Geolocation = {
|
var Geolocation = {
|
||||||
|
|
||||||
getCurrentPosition: function(geo_success, geo_error, geo_options) {
|
getCurrentPosition: function(
|
||||||
|
geo_success: Function,
|
||||||
|
geo_error?: Function,
|
||||||
|
geo_options?: Object) {
|
||||||
invariant(
|
invariant(
|
||||||
typeof geo_success === 'function',
|
typeof geo_success === 'function',
|
||||||
'Must provide a valid geo_success callback.'
|
'Must provide a valid geo_success callback.'
|
||||||
|
@ -45,7 +49,7 @@ var Geolocation = {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
watchPosition: function(success, error, options) {
|
watchPosition: function(success: Function, error?: Function, options?: Object): number {
|
||||||
if (!updatesEnabled) {
|
if (!updatesEnabled) {
|
||||||
RCTLocationObserver.startObserving(options || {});
|
RCTLocationObserver.startObserving(options || {});
|
||||||
updatesEnabled = true;
|
updatesEnabled = true;
|
||||||
|
@ -64,15 +68,17 @@ var Geolocation = {
|
||||||
return watchID;
|
return watchID;
|
||||||
},
|
},
|
||||||
|
|
||||||
clearWatch: function(watchID) {
|
clearWatch: function(watchID: number) {
|
||||||
var sub = subscriptions[watchID];
|
var sub = subscriptions[watchID];
|
||||||
if (!sub) {
|
if (!sub) {
|
||||||
// Silently exit when the watchID is invalid or already cleared
|
// Silently exit when the watchID is invalid or already cleared
|
||||||
// This is consistent with timers
|
// This is consistent with timers
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub[0].remove();
|
sub[0].remove();
|
||||||
sub[1] && sub[1].remove();
|
// array element refinements not yet enabled in Flow
|
||||||
|
var sub1 = sub[1]; sub1 && sub1.remove();
|
||||||
subscriptions[watchID] = undefined;
|
subscriptions[watchID] = undefined;
|
||||||
var noWatchers = true;
|
var noWatchers = true;
|
||||||
for (var ii = 0; ii < subscriptions.length; ii++) {
|
for (var ii = 0; ii < subscriptions.length; ii++) {
|
||||||
|
@ -90,9 +96,12 @@ var Geolocation = {
|
||||||
RCTLocationObserver.stopObserving();
|
RCTLocationObserver.stopObserving();
|
||||||
updatesEnabled = false;
|
updatesEnabled = false;
|
||||||
for (var ii = 0; ii < subscriptions.length; ii++) {
|
for (var ii = 0; ii < subscriptions.length; ii++) {
|
||||||
if (subscriptions[ii]) {
|
var sub = subscriptions[ii];
|
||||||
|
if (sub) {
|
||||||
warning('Called stopObserving with existing subscriptions.');
|
warning('Called stopObserving with existing subscriptions.');
|
||||||
subscriptions[ii].remove();
|
sub[0].remove();
|
||||||
|
// array element refinements not yet enabled in Flow
|
||||||
|
var sub1 = sub[1]; sub1 && sub1.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subscriptions = [];
|
subscriptions = [];
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ReactIOSEventEmitter
|
* @providesModule ReactIOSEventEmitter
|
||||||
* @typechecks static-only
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -57,21 +57,27 @@ var touchSubsequence = function(touches, indices) {
|
||||||
* @param {Array<number>} indices Indices to remove from `touches`.
|
* @param {Array<number>} indices Indices to remove from `touches`.
|
||||||
* @return {Array<Touch>} Subsequence of removed touch objects.
|
* @return {Array<Touch>} Subsequence of removed touch objects.
|
||||||
*/
|
*/
|
||||||
var removeTouchesAtIndices = function(touches, indices) {
|
var removeTouchesAtIndices = function(
|
||||||
|
touches: Array<Object>,
|
||||||
|
indices: Array<number>
|
||||||
|
): Array<Object> {
|
||||||
var rippedOut = [];
|
var rippedOut = [];
|
||||||
|
// use an unsafe downcast to alias to nullable elements,
|
||||||
|
// so we can delete and then compact.
|
||||||
|
var temp: Array<?Object> = (touches: Array<any>);
|
||||||
for (var i = 0; i < indices.length; i++) {
|
for (var i = 0; i < indices.length; i++) {
|
||||||
var index = indices[i];
|
var index = indices[i];
|
||||||
rippedOut.push(touches[index]);
|
rippedOut.push(touches[index]);
|
||||||
touches[index] = null;
|
temp[index] = null;
|
||||||
}
|
}
|
||||||
var fillAt = 0;
|
var fillAt = 0;
|
||||||
for (var j = 0; j < touches.length; j++) {
|
for (var j = 0; j < temp.length; j++) {
|
||||||
var cur = touches[j];
|
var cur = temp[j];
|
||||||
if (cur !== null) {
|
if (cur !== null) {
|
||||||
touches[fillAt++] = cur;
|
temp[fillAt++] = cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
touches.length = fillAt;
|
temp.length = fillAt;
|
||||||
return rippedOut;
|
return rippedOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,7 +112,11 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, {
|
||||||
* @param {TopLevelType} topLevelType Top level type of event.
|
* @param {TopLevelType} topLevelType Top level type of event.
|
||||||
* @param {object} nativeEventParam Object passed from native.
|
* @param {object} nativeEventParam Object passed from native.
|
||||||
*/
|
*/
|
||||||
_receiveRootNodeIDEvent: function(rootNodeID, topLevelType, nativeEventParam) {
|
_receiveRootNodeIDEvent: function(
|
||||||
|
rootNodeID: ?string,
|
||||||
|
topLevelType: string,
|
||||||
|
nativeEventParam: Object
|
||||||
|
) {
|
||||||
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
|
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
|
||||||
ReactIOSEventEmitter.handleTopLevel(
|
ReactIOSEventEmitter.handleTopLevel(
|
||||||
topLevelType,
|
topLevelType,
|
||||||
|
@ -123,7 +133,11 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, {
|
||||||
* @param {TopLevelType} topLevelType Top level type of event.
|
* @param {TopLevelType} topLevelType Top level type of event.
|
||||||
* @param {object} nativeEventParam Object passed from native.
|
* @param {object} nativeEventParam Object passed from native.
|
||||||
*/
|
*/
|
||||||
receiveEvent: function(tag, topLevelType, nativeEventParam) {
|
receiveEvent: function(
|
||||||
|
tag: number,
|
||||||
|
topLevelType: string,
|
||||||
|
nativeEventParam: Object
|
||||||
|
) {
|
||||||
var rootNodeID = ReactIOSTagHandles.tagToRootNodeID[tag];
|
var rootNodeID = ReactIOSTagHandles.tagToRootNodeID[tag];
|
||||||
ReactIOSEventEmitter._receiveRootNodeIDEvent(
|
ReactIOSEventEmitter._receiveRootNodeIDEvent(
|
||||||
rootNodeID,
|
rootNodeID,
|
||||||
|
@ -156,7 +170,11 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, {
|
||||||
* Web desktop polyfills only need to construct a fake touch event with
|
* Web desktop polyfills only need to construct a fake touch event with
|
||||||
* identifier 0, also abandoning traditional click handlers.
|
* identifier 0, also abandoning traditional click handlers.
|
||||||
*/
|
*/
|
||||||
receiveTouches: function(eventTopLevelType, touches, changedIndices) {
|
receiveTouches: function(
|
||||||
|
eventTopLevelType: string,
|
||||||
|
touches: Array<Object>,
|
||||||
|
changedIndices: Array<number>
|
||||||
|
) {
|
||||||
var changedTouches =
|
var changedTouches =
|
||||||
eventTopLevelType === topLevelTypes.topTouchEnd ||
|
eventTopLevelType === topLevelTypes.topTouchEnd ||
|
||||||
eventTopLevelType === topLevelTypes.topTouchCancel ?
|
eventTopLevelType === topLevelTypes.topTouchCancel ?
|
||||||
|
|
|
@ -18,7 +18,10 @@ var ViewStylePropTypes = require('ViewStylePropTypes');
|
||||||
var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
|
var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
|
||||||
fontFamily: ReactPropTypes.string,
|
fontFamily: ReactPropTypes.string,
|
||||||
fontSize: ReactPropTypes.number,
|
fontSize: ReactPropTypes.number,
|
||||||
fontWeight: ReactPropTypes.oneOf(['normal' /*default*/, 'bold']),
|
fontWeight: ReactPropTypes.oneOf(
|
||||||
|
['normal' /*default*/, 'bold',
|
||||||
|
'100', '200', '300', '400', '500', '600', '700', '800', '900']
|
||||||
|
),
|
||||||
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
|
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
|
||||||
lineHeight: ReactPropTypes.number,
|
lineHeight: ReactPropTypes.number,
|
||||||
color: ReactPropTypes.string,
|
color: ReactPropTypes.string,
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@interface RCTDevelopmentViewController : UIViewController
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,89 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "RCTDevelopmentViewController.h"
|
||||||
|
|
||||||
|
#import "RCTRedBox.h"
|
||||||
|
#import "RCTRootView.h"
|
||||||
|
|
||||||
|
@interface RCTDevelopmentViewController () <UIActionSheetDelegate> {
|
||||||
|
BOOL _liveReload;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) RCTRootView *RCTView;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation RCTDevelopmentViewController
|
||||||
|
|
||||||
|
- (BOOL)canBecomeFirstResponder
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (RCTRootView *)RCTView
|
||||||
|
{
|
||||||
|
return (RCTRootView *)self.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
|
||||||
|
{
|
||||||
|
if (motion == UIEventSubtypeMotionShake)
|
||||||
|
{
|
||||||
|
NSString *debugTitle = self.RCTView.executorClass == nil ? @"Enable Debugging" : @"Disable Debugging";
|
||||||
|
NSString *liveReloadTitle = _liveReload ? @"Disable Live Reload" : @"Enable Live Reload";
|
||||||
|
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"React Native: Development"
|
||||||
|
delegate:self
|
||||||
|
cancelButtonTitle:@"Cancel"
|
||||||
|
destructiveButtonTitle:nil
|
||||||
|
otherButtonTitles:@"Reload", debugTitle, liveReloadTitle, nil];
|
||||||
|
actionSheet.actionSheetStyle = UIBarStyleBlack;
|
||||||
|
[actionSheet showInView:self.view];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||||
|
{
|
||||||
|
if (buttonIndex == 0) {
|
||||||
|
[self.RCTView reload];
|
||||||
|
} else if (buttonIndex == 1) {
|
||||||
|
self.RCTView.executorClass = self.RCTView.executorClass == nil ? NSClassFromString(@"RCTWebSocketExecutor") : nil;
|
||||||
|
[self.RCTView reload];
|
||||||
|
} else if (buttonIndex == 2) {
|
||||||
|
_liveReload = !_liveReload;
|
||||||
|
[self _pollAndReload];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_pollAndReload
|
||||||
|
{
|
||||||
|
if (_liveReload) {
|
||||||
|
NSURL *url = [self.RCTView scriptURL];
|
||||||
|
NSURL *longPollURL = [[NSURL alloc] initWithString:@"/onchange" relativeToURL:url];
|
||||||
|
[self performSelectorInBackground:@selector(_checkForUpdates:) withObject:longPollURL];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_checkForUpdates:(NSURL *)URL
|
||||||
|
{
|
||||||
|
NSMutableURLRequest *longPollRequest = [NSMutableURLRequest requestWithURL:URL];
|
||||||
|
longPollRequest.timeoutInterval = 30;
|
||||||
|
NSHTTPURLResponse *response;
|
||||||
|
[NSURLConnection sendSynchronousRequest:longPollRequest returningResponse:&response error:nil];
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
if (_liveReload && response.statusCode == 205) {
|
||||||
|
[[RCTRedBox sharedInstance] dismiss];
|
||||||
|
[self.RCTView reload];
|
||||||
|
}
|
||||||
|
[self _pollAndReload];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -52,7 +52,7 @@ static Class _globalExecutorClass;
|
||||||
action:^(UIKeyCommand *command) {
|
action:^(UIKeyCommand *command) {
|
||||||
_globalExecutorClass = NSClassFromString(@"RCTWebSocketExecutor");
|
_globalExecutorClass = NSClassFromString(@"RCTWebSocketExecutor");
|
||||||
if (!_globalExecutorClass) {
|
if (!_globalExecutorClass) {
|
||||||
RCTLogWarn(@"WebSocket debugger is not available. Did you forget to include RCTWebSocketExecutor?");
|
RCTLogError(@"WebSocket debugger is not available. Did you forget to include RCTWebSocketExecutor?");
|
||||||
}
|
}
|
||||||
[self reloadAll];
|
[self reloadAll];
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */; };
|
000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */; };
|
||||||
|
00C1A2B31AC0B7E000E89A1C /* RCTDevelopmentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 00C1A2B21AC0B7E000E89A1C /* RCTDevelopmentViewController.m */; };
|
||||||
134FCB361A6D42D900051CC8 /* RCTSparseArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BEE46D1A6D19BC00B5863B /* RCTSparseArray.m */; };
|
134FCB361A6D42D900051CC8 /* RCTSparseArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BEE46D1A6D19BC00B5863B /* RCTSparseArray.m */; };
|
||||||
134FCB3D1A6E7F0800051CC8 /* RCTContextExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3A1A6E7F0800051CC8 /* RCTContextExecutor.m */; };
|
134FCB3D1A6E7F0800051CC8 /* RCTContextExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3A1A6E7F0800051CC8 /* RCTContextExecutor.m */; };
|
||||||
134FCB3E1A6E7F0800051CC8 /* RCTWebViewExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3C1A6E7F0800051CC8 /* RCTWebViewExecutor.m */; };
|
134FCB3E1A6E7F0800051CC8 /* RCTWebViewExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3C1A6E7F0800051CC8 /* RCTWebViewExecutor.m */; };
|
||||||
|
@ -76,6 +77,8 @@
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSourceCode.h; sourceTree = "<group>"; };
|
000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSourceCode.h; sourceTree = "<group>"; };
|
||||||
000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSourceCode.m; sourceTree = "<group>"; };
|
000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSourceCode.m; sourceTree = "<group>"; };
|
||||||
|
00C1A2B11AC0B7E000E89A1C /* RCTDevelopmentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDevelopmentViewController.h; sourceTree = "<group>"; };
|
||||||
|
00C1A2B21AC0B7E000E89A1C /* RCTDevelopmentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevelopmentViewController.m; sourceTree = "<group>"; };
|
||||||
13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimationType.h; sourceTree = "<group>"; };
|
13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimationType.h; sourceTree = "<group>"; };
|
||||||
13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointerEvents.h; sourceTree = "<group>"; };
|
13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointerEvents.h; sourceTree = "<group>"; };
|
||||||
13442BF41AA90E0B0037E5B0 /* RCTViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTViewControllerProtocol.h; sourceTree = "<group>"; };
|
13442BF41AA90E0B0037E5B0 /* RCTViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTViewControllerProtocol.h; sourceTree = "<group>"; };
|
||||||
|
@ -365,6 +368,8 @@
|
||||||
83CBBA591A601E9000E9B192 /* RCTRedBox.m */,
|
83CBBA591A601E9000E9B192 /* RCTRedBox.m */,
|
||||||
830A229C1A66C68A008503DA /* RCTRootView.h */,
|
830A229C1A66C68A008503DA /* RCTRootView.h */,
|
||||||
830A229D1A66C68A008503DA /* RCTRootView.m */,
|
830A229D1A66C68A008503DA /* RCTRootView.m */,
|
||||||
|
00C1A2B11AC0B7E000E89A1C /* RCTDevelopmentViewController.h */,
|
||||||
|
00C1A2B21AC0B7E000E89A1C /* RCTDevelopmentViewController.m */,
|
||||||
83BEE46C1A6D19BC00B5863B /* RCTSparseArray.h */,
|
83BEE46C1A6D19BC00B5863B /* RCTSparseArray.h */,
|
||||||
83BEE46D1A6D19BC00B5863B /* RCTSparseArray.m */,
|
83BEE46D1A6D19BC00B5863B /* RCTSparseArray.m */,
|
||||||
83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */,
|
83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */,
|
||||||
|
@ -494,6 +499,7 @@
|
||||||
13B0801A1A69489C00A75B9A /* RCTNavigator.m in Sources */,
|
13B0801A1A69489C00A75B9A /* RCTNavigator.m in Sources */,
|
||||||
830BA4551A8E3BDA00D53203 /* RCTCache.m in Sources */,
|
830BA4551A8E3BDA00D53203 /* RCTCache.m in Sources */,
|
||||||
137327E71AA5CF210034F82E /* RCTTabBar.m in Sources */,
|
137327E71AA5CF210034F82E /* RCTTabBar.m in Sources */,
|
||||||
|
00C1A2B31AC0B7E000E89A1C /* RCTDevelopmentViewController.m in Sources */,
|
||||||
14435CE51AAC4AE100FC20F4 /* RCTMap.m in Sources */,
|
14435CE51AAC4AE100FC20F4 /* RCTMap.m in Sources */,
|
||||||
134FCB3E1A6E7F0800051CC8 /* RCTWebViewExecutor.m in Sources */,
|
134FCB3E1A6E7F0800051CC8 /* RCTWebViewExecutor.m in Sources */,
|
||||||
13B0801C1A69489C00A75B9A /* RCTNavItem.m in Sources */,
|
13B0801C1A69489C00A75B9A /* RCTNavItem.m in Sources */,
|
||||||
|
|
Loading…
Reference in New Issue