mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 07:35:25 +00:00
Updates from Tue 17 Mar
- [ReactNative] Remove pushNotification prop from renderApplication | Eric Vicenti - [react_native] Stub VibrationIOS on Android | Andy Street - [ReactNative] Simplify and test interpolators | Christopher Chedeau - [ReactNative] Increase timeout for obj-c tests | Christopher Chedeau - [ReactNative] Updated RKText to new UIManager system | Nick Lockwood - [ReactNative] Unforked RCTShadowView, moved RKTextView into FBReactKitTextModule | Nick Lockwood - [ReactKit] Remove NativeModulesDeprecated | Spencer Ahrens - [ReactNative] Allow single callbacks in NativeModules | Spencer Ahrens - [ReactNative] s/RK/RCT in OSS | Spencer Ahrens - [ReactNative] Cleanup StyleSheet API | Christopher Chedeau - [RCTVibration] Basic Vibration API | Christopher Chedeau - [React Native] Prevent crash in redbox code with two thrown errors | Ben Alpert - [ReactNative] unbreak Android | Andrew Rasmussen
This commit is contained in:
parent
299dea8594
commit
f7cf017d29
@ -19,6 +19,7 @@
|
||||
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
|
||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */; };
|
||||
D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -78,6 +79,13 @@
|
||||
remoteGlobalIDString = 134814201AA4EA6300B7C361;
|
||||
remoteInfo = RCTActionSheet;
|
||||
};
|
||||
D85B829B1AB6D5CE003F4FE2 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
|
||||
remoteInfo = RCTVibration;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -98,6 +106,7 @@
|
||||
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<group>"; };
|
||||
D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../../Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -112,6 +121,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */,
|
||||
147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */,
|
||||
134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */,
|
||||
134A8A2A1AACED7A00945AAE /* libRCTGeolocation.a in Frameworks */,
|
||||
@ -145,6 +155,7 @@
|
||||
1316A21D1AA397F400C0188E /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */,
|
||||
14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */,
|
||||
13417FFA1AA91531003F314A /* ReactKit.xcodeproj */,
|
||||
134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */,
|
||||
@ -244,6 +255,14 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D85B82921AB6D5CE003F4FE2 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -333,6 +352,10 @@
|
||||
ProductGroup = 13417FEB1AA914B8003F314A /* Products */;
|
||||
ProjectRef = 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = D85B82921AB6D5CE003F4FE2 /* Products */;
|
||||
ProjectRef = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 13417FFB1AA91531003F314A /* Products */;
|
||||
ProjectRef = 13417FFA1AA91531003F314A /* ReactKit.xcodeproj */;
|
||||
@ -396,6 +419,13 @@
|
||||
remoteRef = 147CED4A1AB34F8C00DA3E4C /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libRCTVibration.a;
|
||||
remoteRef = D85B829B1AB6D5CE003F4FE2 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
|
@ -47,6 +47,7 @@ var EXAMPLES = [
|
||||
require('./AdSupportIOSExample'),
|
||||
require('./AppStateExample'),
|
||||
require('./ActionSheetIOSExample'),
|
||||
require('./VibrationIOSExample'),
|
||||
];
|
||||
|
||||
var UIExplorerList = React.createClass({
|
||||
|
@ -3,7 +3,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#define TIMEOUT_SECONDS 30
|
||||
#define TIMEOUT_SECONDS 240
|
||||
|
||||
@interface UIExplorerTests : XCTestCase
|
||||
|
||||
|
42
Examples/UIExplorer/VibrationIOSExample.js
Normal file
42
Examples/UIExplorer/VibrationIOSExample.js
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var React = require('react-native');
|
||||
var {
|
||||
StyleSheet,
|
||||
View,
|
||||
Text,
|
||||
TouchableHighlight,
|
||||
VibrationIOS
|
||||
} = React;
|
||||
|
||||
exports.framework = 'React';
|
||||
exports.title = 'VibrationIOS';
|
||||
exports.description = 'Vibration API for iOS';
|
||||
exports.examples = [{
|
||||
title: 'VibrationIOS.vibrate()',
|
||||
render() {
|
||||
return (
|
||||
<TouchableHighlight
|
||||
style={styles.wrapper}
|
||||
onPress={() => VibrationIOS.vibrate()}>
|
||||
<View style={styles.button}>
|
||||
<Text>Vibrate</Text>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
);
|
||||
},
|
||||
}];
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
wrapper: {
|
||||
borderRadius: 5,
|
||||
marginBottom: 5,
|
||||
},
|
||||
button: {
|
||||
backgroundColor: '#eeeeee',
|
||||
padding: 10,
|
||||
},
|
||||
});
|
@ -5,8 +5,9 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var { RCTActionSheetManager } = require('NativeModules');
|
||||
|
||||
var invariant = require('invariant');
|
||||
var RCTActionSheetManager = require('NativeModulesDeprecated').RKActionSheetManager;
|
||||
|
||||
var ActionSheetIOS = {
|
||||
showActionSheetWithOptions(options, callback) {
|
||||
|
@ -8,197 +8,191 @@
|
||||
|
||||
type EasingFunction = (t: number) => number;
|
||||
|
||||
var b = 0,
|
||||
c = 1,
|
||||
d = 1;
|
||||
var defaults = {
|
||||
easeInQuad: function(t) {
|
||||
return c * (t /= 1) * t + b;
|
||||
return t * t;
|
||||
},
|
||||
easeOutQuad: function(t) {
|
||||
return -c * (t /= d) * (t - 2) + b;
|
||||
return -t * (t - 2);
|
||||
},
|
||||
easeInOutQuad: function(t) {
|
||||
if ((t /= d / 2) < 1) {
|
||||
return c / 2 * t * t + b;
|
||||
t = t * 2;
|
||||
if (t < 1) {
|
||||
return 0.5 * t * t;
|
||||
}
|
||||
return -c / 2 * ((--t) * (t - 2) - 1) + b;
|
||||
return -((t - 1) * (t - 3) - 1) / 2;
|
||||
},
|
||||
easeInCubic: function(t) {
|
||||
return c * (t /= d) * t * t + b;
|
||||
return t * t * t;
|
||||
},
|
||||
easeOutCubic: function(t) {
|
||||
return c * ((t = t / d - 1) * t * t + 1) + b;
|
||||
t -= 1;
|
||||
return t * t * t + 1;
|
||||
},
|
||||
easeInOutCubic: function(t) {
|
||||
if ((t /= d / 2) < 1) {
|
||||
return c / 2 * t * t * t + b;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return 0.5 * t * t * t;
|
||||
}
|
||||
return c / 2 * ((t -= 2) * t * t + 2) + b;
|
||||
t -= 2;
|
||||
return (t * t * t + 2) / 2;
|
||||
},
|
||||
easeInQuart: function(t) {
|
||||
return c * (t /= d) * t * t * t + b;
|
||||
return t * t * t * t;
|
||||
},
|
||||
easeOutQuart: function(t) {
|
||||
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
|
||||
t -= 1;
|
||||
return -(t * t * t * t - 1);
|
||||
},
|
||||
easeInOutQuart: function(t) {
|
||||
if ((t /= d / 2) < 1) {
|
||||
return c / 2 * t * t * t * t + b;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return 0.5 * t * t * t * t;
|
||||
}
|
||||
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
|
||||
t -= 2;
|
||||
return -(t * t * t * t - 2) / 2;
|
||||
},
|
||||
easeInQuint: function(t) {
|
||||
return c * (t /= d) * t * t * t * t + b;
|
||||
return t * t * t * t * t;
|
||||
},
|
||||
easeOutQuint: function(t) {
|
||||
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
|
||||
t -= 1;
|
||||
return t * t * t * t * t + 1;
|
||||
},
|
||||
easeInOutQuint: function(t) {
|
||||
if ((t /= d / 2) < 1) {
|
||||
return c / 2 * t * t * t * t * t + b;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return (t * t * t * t * t) / 2;
|
||||
}
|
||||
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
|
||||
t -= 2;
|
||||
return (t * t * t * t * t + 2) / 2;
|
||||
},
|
||||
easeInSine: function(t) {
|
||||
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
|
||||
return -Math.cos(t * (Math.PI / 2)) + 1;
|
||||
},
|
||||
easeOutSine: function(t) {
|
||||
return c * Math.sin(t / d * (Math.PI / 2)) + b;
|
||||
return Math.sin(t * (Math.PI / 2));
|
||||
},
|
||||
easeInOutSine: function(t) {
|
||||
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
|
||||
return -(Math.cos(Math.PI * t) - 1) / 2;
|
||||
},
|
||||
easeInExpo: function(t) {
|
||||
return (t === 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
|
||||
return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1));
|
||||
},
|
||||
easeOutExpo: function(t) {
|
||||
return (t === d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
|
||||
return (t === 1) ? 1 : (-Math.pow(2, -10 * t) + 1);
|
||||
},
|
||||
easeInOutExpo: function(t) {
|
||||
if (t === 0) {
|
||||
return b;
|
||||
return 0;
|
||||
}
|
||||
if (t === d) {
|
||||
return b + c;
|
||||
if (t === 1) {
|
||||
return 1;
|
||||
}
|
||||
if ((t /= d / 2) < 1) {
|
||||
return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return 0.5 * Math.pow(2, 10 * (t - 1));
|
||||
}
|
||||
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
return (-Math.pow(2, -10 * (t - 1)) + 2) / 2;
|
||||
},
|
||||
easeInCirc: function(t) {
|
||||
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
|
||||
return -(Math.sqrt(1 - t * t) - 1);
|
||||
},
|
||||
easeOutCirc: function(t) {
|
||||
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
|
||||
t -= 1;
|
||||
return Math.sqrt(1 - t * t);
|
||||
},
|
||||
easeInOutCirc: function(t) {
|
||||
if ((t /= d / 2) < 1) {
|
||||
return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return -(Math.sqrt(1 - t * t) - 1) / 2;
|
||||
}
|
||||
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
|
||||
t -= 2;
|
||||
return (Math.sqrt(1 - t * t) + 1) / 2;
|
||||
},
|
||||
easeInElastic: function(t) {
|
||||
var s = 1.70158;
|
||||
var p = 0;
|
||||
var a = c;
|
||||
var p = 0.3;
|
||||
if (t === 0) {
|
||||
return b;
|
||||
return 0;
|
||||
}
|
||||
if ((t /= d) === 1) {
|
||||
return b + c;
|
||||
if (t === 1) {
|
||||
return 1;
|
||||
}
|
||||
if (!p) {
|
||||
p = d * 0.3;
|
||||
}
|
||||
if (a < Math.abs(c)) {
|
||||
a = c;
|
||||
var s = p / 4;
|
||||
} else {
|
||||
var s = p / (2 * Math.PI) * Math.asin(c / a);
|
||||
}
|
||||
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
||||
var s = p / (2 * Math.PI) * Math.asin(1);
|
||||
t -= 1;
|
||||
return -(Math.pow(2, 10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p));
|
||||
},
|
||||
easeOutElastic: function(t) {
|
||||
var s = 1.70158;
|
||||
var p = 0;
|
||||
var a = c;
|
||||
var p = 0.3;
|
||||
if (t === 0) {
|
||||
return b;
|
||||
return 0;
|
||||
}
|
||||
if ((t /= d) === 1) {
|
||||
return b + c;
|
||||
if (t === 1) {
|
||||
return 1;
|
||||
}
|
||||
if (!p) {
|
||||
p = d * 0.3;
|
||||
}
|
||||
if (a < Math.abs(c)) {
|
||||
a = c;
|
||||
var s = p / 4;
|
||||
} else {
|
||||
var s = p / (2 * Math.PI) * Math.asin(c / a);
|
||||
}
|
||||
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
|
||||
var s = p / (2 * Math.PI) * Math.asin(1);
|
||||
return Math.pow(2, -10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) + 1;
|
||||
},
|
||||
easeInOutElastic: function(t) {
|
||||
var s = 1.70158;
|
||||
var p = 0;
|
||||
var a = c;
|
||||
var p = 0.3 * 1.5;
|
||||
if (t === 0) {
|
||||
return b;
|
||||
return 0;
|
||||
}
|
||||
if ((t /= d / 2) === 2) {
|
||||
return b + c;
|
||||
}
|
||||
if (!p) {
|
||||
p = d * (0.3 * 1.5);
|
||||
}
|
||||
if (a < Math.abs(c)) {
|
||||
a = c;
|
||||
var s = p / 4;
|
||||
} else {
|
||||
var s = p / (2 * Math.PI) * Math.asin(c / a);
|
||||
t *= 2;
|
||||
if (t === 2) {
|
||||
return 1;
|
||||
}
|
||||
var s = p / (2 * Math.PI) * Math.asin(1);
|
||||
if (t < 1) {
|
||||
return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
||||
t -= 1;
|
||||
return -(Math.pow(2, 10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p)) / 2;
|
||||
}
|
||||
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;
|
||||
t -= 1;
|
||||
return Math.pow(2, -10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) / 2 + 1;
|
||||
},
|
||||
easeInBack: function(t) {
|
||||
var s = 1.70158;
|
||||
return c * (t /= d) * t * ((s + 1) * t - s) + b;
|
||||
return t * t * ((s + 1) * t - s);
|
||||
},
|
||||
easeOutBack: function(t) {
|
||||
var s = 1.70158;
|
||||
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
|
||||
t -= 1;
|
||||
return (t * t * ((s + 1) * t + s) + 1);
|
||||
},
|
||||
easeInOutBack: function(t) {
|
||||
var s = 1.70158;
|
||||
if ((t /= d / 2) < 1) {
|
||||
return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
|
||||
var s = 1.70158 * 1.525;
|
||||
t *= 2;
|
||||
if (t < 1) {
|
||||
return (t * t * ((s + 1) * t - s)) / 2;
|
||||
}
|
||||
return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
|
||||
t -= 2;
|
||||
return (t * t * ((s + 1) * t + s) + 2) / 2;
|
||||
},
|
||||
easeInBounce: function(t) {
|
||||
return c - this.easeOutBounce(d - t) + b;
|
||||
return 1 - this.easeOutBounce(1 - t);
|
||||
},
|
||||
easeOutBounce: function(t) {
|
||||
if ((t /= d) < (1 / 2.75)) {
|
||||
return c * (7.5625 * t * t) + b;
|
||||
if (t < (1 / 2.75)) {
|
||||
return 7.5625 * t * t;
|
||||
} else if (t < (2 / 2.75)) {
|
||||
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75) + b;
|
||||
t -= 1.5 / 2.75;
|
||||
return 7.5625 * t * t + 0.75;
|
||||
} else if (t < (2.5 / 2.75)) {
|
||||
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b;
|
||||
t -= 2.25 / 2.75;
|
||||
return 7.5625 * t * t + 0.9375;
|
||||
} else {
|
||||
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b;
|
||||
t -= 2.625 / 2.75;
|
||||
return 7.5625 * t * t + 0.984375;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function(t) {
|
||||
if (t < d / 2) {
|
||||
return this.easeInBounce(t * 2) * 0.5 + b;
|
||||
if (t < 0.5) {
|
||||
return this.easeInBounce(t * 2) / 2;
|
||||
}
|
||||
return this.easeOutBounce(t * 2 - d) * 0.5 + c * 0.5 + b;
|
||||
return this.easeOutBounce(t * 2 - 1) / 2 + 0.5;
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
var PropTypes = require('ReactPropTypes');
|
||||
var RKUIManager = require('NativeModules').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
||||
var keyMirror = require('keyMirror');
|
||||
@ -47,7 +47,7 @@ var configChecker = createStrictShapeTypeChecker({
|
||||
var LayoutAnimation = {
|
||||
configureNext(config, onAnimationDidEnd, onError) {
|
||||
configChecker({config}, 'config', 'LayoutAnimation.configureNext');
|
||||
RKUIManager.configureNextLayoutAnimation(config, onAnimationDidEnd, onError);
|
||||
RCTUIManager.configureNextLayoutAnimation(config, onAnimationDidEnd, onError);
|
||||
},
|
||||
create(duration, type, creationProp) {
|
||||
return {
|
||||
|
46
Libraries/Animation/__tests__/AnimationUtils-test.js
Normal file
46
Libraries/Animation/__tests__/AnimationUtils-test.js
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
jest.autoMockOff();
|
||||
|
||||
var AnimationUtils = require('AnimationUtils');
|
||||
|
||||
describe('AnimationUtils', function() {
|
||||
var DURATION = 300;
|
||||
|
||||
var Samples = {
|
||||
easeInQuad: [0,0.0030864197530864196,0.012345679012345678,0.027777777777777776,0.04938271604938271,0.0771604938271605,0.1111111111111111,0.15123456790123457,0.19753086419753085,0.25,0.308641975308642,0.37345679012345684,0.4444444444444444,0.5216049382716049,0.6049382716049383,0.6944444444444445,0.7901234567901234,0.8919753086419753,1],
|
||||
easeOutQuad: [0,0.10802469135802469,0.20987654320987653,0.3055555555555555,0.3950617283950617,0.47839506172839513,0.5555555555555556,0.6265432098765432,0.691358024691358,0.75,0.8024691358024691,0.8487654320987654,0.888888888888889,0.9228395061728394,0.9506172839506174,0.9722222222222221,0.9876543209876543,0.9969135802469136,1],
|
||||
easeInOutQuad: [0,0.006172839506172839,0.024691358024691357,0.05555555555555555,0.09876543209876543,0.154320987654321,0.2222222222222222,0.30246913580246915,0.3950617283950617,0.5,0.6049382716049383,0.697530864197531,0.7777777777777777,0.845679012345679,0.9012345679012346,0.9444444444444444,0.9753086419753086,0.9938271604938271,1],
|
||||
easeInCubic: [0,0.00017146776406035664,0.0013717421124828531,0.004629629629629629,0.010973936899862825,0.021433470507544586,0.037037037037037035,0.05881344307270234,0.0877914951989026,0.125,0.1714677640603567,0.22822359396433475,0.2962962962962963,0.37671467764060357,0.4705075445816187,0.5787037037037038,0.7023319615912208,0.8424211248285322,1],
|
||||
easeOutCubic: [0,0.15757887517146785,0.2976680384087792,0.42129629629629617,0.5294924554183813,0.6232853223593964,0.7037037037037036,0.7717764060356652,0.8285322359396433,0.875,0.9122085048010974,0.9411865569272977,0.9629629629629629,0.9785665294924554,0.9890260631001372,0.9953703703703703,0.9986282578875172,0.9998285322359396,1],
|
||||
easeInOutCubic: [0,0.0006858710562414266,0.0054869684499314125,0.018518518518518517,0.0438957475994513,0.08573388203017834,0.14814814814814814,0.23525377229080935,0.3511659807956104,0.5,0.6488340192043895,0.7647462277091908,0.8518518518518519,0.9142661179698217,0.9561042524005487,0.9814814814814815,0.9945130315500685,0.9993141289437586,1],
|
||||
easeInQuart: [0,0.000009525986892242035,0.00015241579027587256,0.0007716049382716049,0.002438652644413961,0.005953741807651274,0.012345679012345678,0.02287189452827313,0.039018442310623375,0.0625,0.09525986892242039,0.1394699740893157,0.19753086419753085,0.2720717116293248,0.3659503124523701,0.48225308641975323,0.624295076969974,0.7956199512269471,1],
|
||||
easeOutQuart: [0,0.20438004877305294,0.375704923030026,0.5177469135802468,0.6340496875476299,0.7279282883706752,0.802469135802469,0.8605300259106843,0.9047401310775796,0.9375,0.9609815576893767,0.9771281054717269,0.9876543209876543,0.9940462581923487,0.997561347355586,0.9992283950617284,0.9998475842097241,0.9999904740131078,1],
|
||||
easeInOutQuart: [0,0.00007620789513793628,0.0012193263222069805,0.006172839506172839,0.019509221155311687,0.047629934461210194,0.09876543209876543,0.18297515622618504,0.312147538484987,0.5,0.687852461515013,0.8170248437738151,0.9012345679012346,0.9523700655387898,0.9804907788446883,0.9938271604938271,0.998780673677793,0.999923792104862,1],
|
||||
easeInQuint: [0,5.292214940134463e-7,0.000016935087808430282,0.00012860082304526747,0.000541922809869769,0.0016538171687920206,0.004115226337448559,0.008894625649883995,0.01734152991583261,0.03125,0.05292214940134466,0.08523165083235959,0.1316872427983539,0.1964962361767346,0.28462802079628785,0.401877572016461,0.5549289573066435,0.75141884282545,1],
|
||||
easeOutQuint: [0,0.24858115717454998,0.4450710426933565,0.598122427983539,0.7153719792037121,0.8035037638232654,0.868312757201646,0.9147683491676404,0.9470778505986553,0.96875,0.9826584700841674,0.991105374350116,0.9958847736625515,0.998346182831208,0.9994580771901302,0.9998713991769548,0.9999830649121916,0.999999470778506,1],
|
||||
easeInOutQuint: [0,0.000008467543904215141,0.0002709614049348845,0.0020576131687242796,0.008670764957916305,0.02646107470067233,0.06584362139917695,0.14231401039814393,0.27746447865332174,0.5,0.7225355213466782,0.8576859896018563,0.934156378600823,0.9735389252993276,0.9913292350420837,0.9979423868312757,0.9997290385950651,0.9999915324560957,1],
|
||||
easeInSine: [0,0.003805301908254455,0.01519224698779198,0.03407417371093169,0.06030737921409157,0.09369221296335006,0.1339745962155613,0.1808479557110082,0.233955556881022,0.2928932188134524,0.35721239031346064,0.42642356364895384,0.4999999999999999,0.5773817382593005,0.6579798566743311,0.7411809548974793,0.8263518223330696,0.9128442572523416,0.9999999999999999],
|
||||
easeOutSine: [0,0.08715574274765817,0.17364817766693033,0.25881904510252074,0.3420201433256687,0.42261826174069944,0.49999999999999994,0.573576436351046,0.6427876096865393,0.7071067811865475,0.766044443118978,0.8191520442889918,0.8660254037844386,0.9063077870366499,0.9396926207859083,0.9659258262890683,0.984807753012208,0.9961946980917455,1],
|
||||
easeInOutSine: [0,0.00759612349389599,0.030153689607045786,0.06698729810778065,0.116977778440511,0.17860619515673032,0.24999999999999994,0.32898992833716556,0.4131759111665348,0.49999999999999994,0.5868240888334652,0.6710100716628343,0.7499999999999999,0.8213938048432696,0.883022221559489,0.9330127018922194,0.9698463103929542,0.9924038765061041,1],
|
||||
easeInExpo: [0,0.0014352875901128893,0.002109491677524035,0.0031003926796253885,0.004556754060844206,0.006697218616039631,0.009843133202303688,0.014466792379488908,0.021262343752724643,0.03125,0.045929202883612456,0.06750373368076916,0.09921256574801243,0.1458161299470146,0.2143109957132682,0.31498026247371835,0.46293735614364506,0.6803950000871883,1],
|
||||
easeOutExpo: [0,0.31960499991281155,0.5370626438563548,0.6850197375262816,0.7856890042867318,0.8541838700529854,0.9007874342519875,0.9324962663192309,0.9540707971163875,0.96875,0.9787376562472754,0.9855332076205111,0.9901568667976963,0.9933027813839603,0.9954432459391558,0.9968996073203746,0.9978905083224759,0.9985647124098871,1],
|
||||
easeInOutExpo: [0,0.0010547458387620175,0.002278377030422103,0.004921566601151844,0.010631171876362321,0.022964601441806228,0.049606282874006216,0.1071554978566341,0.23146867807182253,0.5,0.7685313219281775,0.892844502143366,0.9503937171259937,0.9770353985581938,0.9893688281236377,0.9950784333988482,0.9977216229695779,0.998945254161238,1],
|
||||
easeInCirc: [0,0.0015444024660317135,0.006192010000093506,0.013986702816730645,0.025003956956430873,0.03935464078941209,0.057190958417936644,0.07871533601238889,0.10419358352238339,0.1339745962155614,0.1685205807169019,0.20845517506805522,0.2546440075000701,0.3083389112228482,0.37146063894529113,0.4472292016074334,0.5418771527091488,0.6713289009389102,1],
|
||||
easeOutCirc: [0,0.3286710990610898,0.45812284729085123,0.5527707983925666,0.6285393610547089,0.6916610887771518,0.7453559924999298,0.7915448249319448,0.8314794192830981,0.8660254037844386,0.8958064164776166,0.9212846639876111,0.9428090415820634,0.9606453592105879,0.9749960430435691,0.9860132971832694,0.9938079899999065,0.9984555975339683,1],
|
||||
easeInOutCirc: [0,0.003096005000046753,0.012501978478215436,0.028595479208968322,0.052096791761191696,0.08426029035845095,0.12732200375003505,0.18573031947264557,0.2709385763545744,0.5,0.7290614236454256,0.8142696805273546,0.8726779962499649,0.915739709641549,0.9479032082388084,0.9714045207910317,0.9874980215217846,0.9969039949999532,1],
|
||||
easeInElastic: [0,0.0008570943160003016,0.0020526300563455885,0.0005383775388688477,-0.003807112477441741,-0.005595444524068916,0.0017092421431128787,0.014076838118604966,0.012696991251677569,-0.015625000000000045,-0.045618646044515744,-0.01936028903971309,0.07600123467884114,0.13030605320629246,-0.012461076179381799,-0.29598462833976175,-0.3176868895106366,0.2694906924487451,1],
|
||||
easeOutElastic: [0,0.7305093075512543,1.3176868895106364,1.2959846283397618,1.0124610761793817,0.8696939467937076,0.9239987653211588,1.019360289039713,1.0456186460445158,1.015625,0.9873030087483224,0.9859231618813951,0.9982907578568871,1.005595444524069,1.0038071124774417,0.9994616224611311,0.9979473699436544,0.9991429056839997,1],
|
||||
easeInOutElastic: [0,0.0010420781824747765,-0.0003083357248478688,-0.004888288728445655,0.0010292130059457788,0.022895545534212507,-0.0028843488305936938,-0.10707491183281304,0.004488485931276091,0.5,0.995511514068724,1.107074911832813,1.0028843488305939,0.9771044544657875,0.9989707869940542,1.0048882887284456,1.000308335724848,0.9989579218175252,1],
|
||||
easeInBack: [0,-0.004788556241426612,-0.017301289437585736,-0.0347587962962963,-0.05438167352537723,-0.07339051783264748,-0.08900592592592595,-0.09844849451303156,-0.0989388203017833,-0.08769750000000004,-0.06194513031550073,-0.018902307956104283,0.044210370370370254,0.13017230795610413,0.2417629080932785,0.3817615740740742,0.5529477091906719,0.7581007167352535,0.9999999999999998],
|
||||
easeOutBack: [2.220446049250313e-16,0.24189928326474652,0.44705229080932807,0.6182384259259258,0.7582370919067215,0.8698276920438959,0.9557896296296297,1.0189023079561044,1.0619451303155008,1.0876975,1.0989388203017834,1.0984484945130315,1.089005925925926,1.0733905178326475,1.0543816735253773,1.0347587962962963,1.0173012894375857,1.0047885562414267,1],
|
||||
easeInOutBack: [0,-0.01355231550068587,-0.04434668449931412,-0.07758924074074074,-0.09848611796982167,-0.0922434499314129,-0.0440673703703704,0.060835986968449905,0.237260488340192,0.5,0.762739511659808,0.9391640130315503,1.0440673703703702,1.0922434499314129,1.0984861179698218,1.0775892407407408,1.0443466844993141,1.0135523155006858,1],
|
||||
};
|
||||
|
||||
Object.keys(Samples).forEach(function(type) {
|
||||
it('should interpolate ' + type, function() {
|
||||
expect(AnimationUtils.evaluateEasingFunction(DURATION, type))
|
||||
.toEqual(Samples[type]);
|
||||
});
|
||||
});
|
||||
});
|
@ -5,22 +5,17 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var NativeModules = require('NativeModulesDeprecated');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var RKAppState = NativeModules.RKAppState;
|
||||
var RKReachability = NativeModules.RKReachability;
|
||||
var Subscribable = require('Subscribable');
|
||||
|
||||
var keyMirror = require('keyMirror');
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTAppState = NativeModules.RCTAppState;
|
||||
|
||||
var AppState = {
|
||||
|
||||
setApplicationIconBadgeNumber: function(number) {
|
||||
RKAppState.setApplicationIconBadgeNumber(number);
|
||||
RCTAppState.setApplicationIconBadgeNumber(number);
|
||||
},
|
||||
|
||||
getApplicationIconBadgeNumber: function(callback) {
|
||||
RKAppState.getApplicationIconBadgeNumber(callback);
|
||||
RCTAppState.getApplicationIconBadgeNumber(callback);
|
||||
},
|
||||
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var RKAppState = NativeModules.RKAppState;
|
||||
var RCTAppState = NativeModules.RCTAppState;
|
||||
|
||||
var logError = require('logError');
|
||||
|
||||
@ -45,7 +45,7 @@ RCTDeviceEventEmitter.addListener(
|
||||
}
|
||||
);
|
||||
|
||||
RKAppState.getCurrentAppState(
|
||||
RCTAppState.getCurrentAppState(
|
||||
(appStateData) => {
|
||||
AppStateIOS.currentState = appStateData.app_state;
|
||||
},
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
var NativeModules = require('BatchedBridge').RemoteModules;
|
||||
|
||||
// Dirty hack to support old (RK) and new (RCT) native module name conventions
|
||||
Object.keys(NativeModules).forEach((moduleName) => {
|
||||
var rkModuleName = moduleName.replace(/^RCT/, 'RK');
|
||||
NativeModules[rkModuleName] = NativeModules[moduleName];
|
||||
});
|
||||
var nativeModulePrefixDuplicator = require('nativeModulePrefixDuplicator');
|
||||
|
||||
nativeModulePrefixDuplicator(NativeModules);
|
||||
|
||||
module.exports = NativeModules;
|
||||
|
@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule NativeModulesDeprecated
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RemoteModulesDeprecated = require('BatchedBridge').RemoteModulesDeprecated;
|
||||
|
||||
// Dirty hack to support old (RK) and new (RCT) native module name conventions
|
||||
Object.keys(RemoteModulesDeprecated).forEach((moduleName) => {
|
||||
var rkModuleName = moduleName.replace(/^RCT/, 'RK');
|
||||
RemoteModulesDeprecated[rkModuleName] = RemoteModulesDeprecated[moduleName];
|
||||
});
|
||||
|
||||
module.exports = RemoteModulesDeprecated;
|
@ -5,8 +5,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RKPOPAnimationManager = require('NativeModulesDeprecated').RKPOPAnimationManager;
|
||||
if (!RKPOPAnimationManager) {
|
||||
var RCTPOPAnimationManager = require('NativeModules').RCTPOPAnimationManager;
|
||||
if (!RCTPOPAnimationManager) {
|
||||
// POP animation isn't available in the OSS fork - this is a temporary
|
||||
// workaround to enable its availability to be determined at runtime.
|
||||
module.exports = null;
|
||||
@ -18,45 +18,45 @@ var getObjectValues = require('getObjectValues');
|
||||
var invariant = require('invariant');
|
||||
var merge = require('merge');
|
||||
|
||||
var RKTypes = RKPOPAnimationManager.Types;
|
||||
var RKProperties = RKPOPAnimationManager.Properties;
|
||||
var RCTTypes = RCTPOPAnimationManager.Types;
|
||||
var RCTProperties = RCTPOPAnimationManager.Properties;
|
||||
|
||||
var Properties = {
|
||||
bounds: RKProperties.bounds,
|
||||
opacity: RKProperties.opacity,
|
||||
position: RKProperties.position,
|
||||
positionX: RKProperties.positionX,
|
||||
positionY: RKProperties.positionY,
|
||||
zPosition: RKProperties.zPosition,
|
||||
rotation: RKProperties.rotation,
|
||||
rotationX: RKProperties.rotationX,
|
||||
rotationY: RKProperties.rotationY,
|
||||
scaleX: RKProperties.scaleX,
|
||||
scaleXY: RKProperties.scaleXY,
|
||||
scaleY: RKProperties.scaleY,
|
||||
shadowColor: RKProperties.shadowColor,
|
||||
shadowOffset: RKProperties.shadowOffset,
|
||||
shadowOpacity: RKProperties.shadowOpacity,
|
||||
shadowRadius: RKProperties.shadowRadius,
|
||||
size: RKProperties.size,
|
||||
subscaleXY: RKProperties.subscaleXY,
|
||||
subtranslationX: RKProperties.subtranslationX,
|
||||
subtranslationXY: RKProperties.subtranslationXY,
|
||||
subtranslationY: RKProperties.subtranslationY,
|
||||
subtranslationZ: RKProperties.subtranslationZ,
|
||||
translationX: RKProperties.translationX,
|
||||
translationXY: RKProperties.translationXY,
|
||||
translationY: RKProperties.translationY,
|
||||
translationZ: RKProperties.translationZ,
|
||||
bounds: RCTProperties.bounds,
|
||||
opacity: RCTProperties.opacity,
|
||||
position: RCTProperties.position,
|
||||
positionX: RCTProperties.positionX,
|
||||
positionY: RCTProperties.positionY,
|
||||
zPosition: RCTProperties.zPosition,
|
||||
rotation: RCTProperties.rotation,
|
||||
rotationX: RCTProperties.rotationX,
|
||||
rotationY: RCTProperties.rotationY,
|
||||
scaleX: RCTProperties.scaleX,
|
||||
scaleXY: RCTProperties.scaleXY,
|
||||
scaleY: RCTProperties.scaleY,
|
||||
shadowColor: RCTProperties.shadowColor,
|
||||
shadowOffset: RCTProperties.shadowOffset,
|
||||
shadowOpacity: RCTProperties.shadowOpacity,
|
||||
shadowRadius: RCTProperties.shadowRadius,
|
||||
size: RCTProperties.size,
|
||||
subscaleXY: RCTProperties.subscaleXY,
|
||||
subtranslationX: RCTProperties.subtranslationX,
|
||||
subtranslationXY: RCTProperties.subtranslationXY,
|
||||
subtranslationY: RCTProperties.subtranslationY,
|
||||
subtranslationZ: RCTProperties.subtranslationZ,
|
||||
translationX: RCTProperties.translationX,
|
||||
translationXY: RCTProperties.translationXY,
|
||||
translationY: RCTProperties.translationY,
|
||||
translationZ: RCTProperties.translationZ,
|
||||
};
|
||||
|
||||
var Types = {
|
||||
decay: RKTypes.decay,
|
||||
easeIn: RKTypes.easeIn,
|
||||
easeInEaseOut: RKTypes.easeInEaseOut,
|
||||
easeOut: RKTypes.easeOut,
|
||||
linear: RKTypes.linear,
|
||||
spring: RKTypes.spring,
|
||||
decay: RCTTypes.decay,
|
||||
easeIn: RCTTypes.easeIn,
|
||||
easeInEaseOut: RCTTypes.easeInEaseOut,
|
||||
easeOut: RCTTypes.easeOut,
|
||||
linear: RCTTypes.linear,
|
||||
spring: RCTTypes.spring,
|
||||
};
|
||||
|
||||
var POPAnimation = {
|
||||
@ -98,7 +98,7 @@ var POPAnimation = {
|
||||
);
|
||||
}
|
||||
|
||||
RKPOPAnimationManager.createAnimationInternal(tag, typeName, attrs);
|
||||
RCTPOPAnimationManager.createAnimationInternal(tag, typeName, attrs);
|
||||
return tag;
|
||||
},
|
||||
|
||||
@ -127,35 +127,35 @@ var POPAnimation = {
|
||||
},
|
||||
|
||||
addAnimation: function(nodeHandle, anim, callback) {
|
||||
RKPOPAnimationManager.addAnimation(nodeHandle, anim, callback);
|
||||
RCTPOPAnimationManager.addAnimation(nodeHandle, anim, callback);
|
||||
},
|
||||
|
||||
removeAnimation: function(nodeHandle, anim) {
|
||||
RKPOPAnimationManager.removeAnimation(nodeHandle, anim);
|
||||
RCTPOPAnimationManager.removeAnimation(nodeHandle, anim);
|
||||
},
|
||||
};
|
||||
|
||||
// Make sure that we correctly propagate RKPOPAnimationManager constants
|
||||
// Make sure that we correctly propagate RCTPOPAnimationManager constants
|
||||
// to POPAnimation
|
||||
if (__DEV__) {
|
||||
var allProperties = merge(
|
||||
RKPOPAnimationManager.Properties,
|
||||
RKPOPAnimationManager.Properties
|
||||
RCTPOPAnimationManager.Properties,
|
||||
RCTPOPAnimationManager.Properties
|
||||
);
|
||||
for (var key in allProperties) {
|
||||
invariant(
|
||||
POPAnimation.Properties[key] === RKPOPAnimationManager.Properties[key],
|
||||
POPAnimation.Properties[key] === RCTPOPAnimationManager.Properties[key],
|
||||
'POPAnimation doesn\'t copy property ' + key + ' correctly'
|
||||
);
|
||||
}
|
||||
|
||||
var allTypes = merge(
|
||||
RKPOPAnimationManager.Types,
|
||||
RKPOPAnimationManager.Types
|
||||
RCTPOPAnimationManager.Types,
|
||||
RCTPOPAnimationManager.Types
|
||||
);
|
||||
for (var key in allTypes) {
|
||||
invariant(
|
||||
POPAnimation.Types[key] === RKPOPAnimationManager.Types[key],
|
||||
POPAnimation.Types[key] === RCTPOPAnimationManager.Types[key],
|
||||
'POPAnimation doesn\'t copy type ' + key + ' correctly'
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule RCTAlertManager
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var { RCTAlertManager } = require('NativeModules');
|
||||
|
||||
module.exports = RCTAlertManager;
|
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule RKAlertManager
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RKAlertManager = require('NativeModulesDeprecated').RKAlertManager;
|
||||
|
||||
module.exports = RKAlertManager;
|
@ -22,33 +22,6 @@ var MethodTypes = keyMirror({
|
||||
*/
|
||||
var BatchedBridgeFactory = {
|
||||
MethodTypes: MethodTypes,
|
||||
/**
|
||||
* @deprecated: Remove callsites and delete this method.
|
||||
*
|
||||
* @param {MessageQueue} messageQueue Message queue that has been created with
|
||||
* the `moduleConfig` (among others perhaps).
|
||||
* @param {object} moduleConfig Configuration of module names/method
|
||||
* names to callback types.
|
||||
* @return {object} Remote representation of configured module.
|
||||
*/
|
||||
_createDeprecatedBridgedModule: function(messageQueue, moduleConfig, moduleName) {
|
||||
var remoteModule = mapObject(moduleConfig.methods, function(methodConfig, memberName) {
|
||||
return methodConfig.type === MethodTypes.local ? null : function() {
|
||||
var lastArg = arguments.length ? arguments[arguments.length - 1] : null;
|
||||
var hasCB =
|
||||
typeof lastArg == 'function';
|
||||
var args = slice.call(arguments, 0, arguments.length - (hasCB ? 1 : 0));
|
||||
var cb = hasCB ? lastArg : null;
|
||||
return messageQueue.callDeprecated(moduleName, memberName, args, cb);
|
||||
};
|
||||
});
|
||||
for (var constName in moduleConfig.constants) {
|
||||
warning(!remoteModule[constName], 'saw constant and method named %s', constName);
|
||||
remoteModule[constName] = moduleConfig.constants[constName];
|
||||
}
|
||||
return remoteModule;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {MessageQueue} messageQueue Message queue that has been created with
|
||||
* the `moduleConfig` (among others perhaps).
|
||||
@ -63,14 +36,14 @@ var BatchedBridgeFactory = {
|
||||
var secondLastArg = arguments.length > 1 ? arguments[arguments.length - 2] : null;
|
||||
var hasSuccCB = typeof lastArg === 'function';
|
||||
var hasErrorCB = typeof secondLastArg === 'function';
|
||||
var hasCBs = hasSuccCB;
|
||||
invariant(
|
||||
(hasSuccCB && hasErrorCB) || (!hasSuccCB && !hasErrorCB),
|
||||
'You must supply error callbacks and success callbacks or neither'
|
||||
hasErrorCB && invariant(
|
||||
hasSuccCB,
|
||||
'Cannot have a non-function arg after a function arg.'
|
||||
);
|
||||
var args = slice.call(arguments, 0, arguments.length - (hasCBs ? 2 : 0));
|
||||
var onSucc = hasCBs ? lastArg : null;
|
||||
var onFail = hasCBs ? secondLastArg : null;
|
||||
var numCBs = (hasSuccCB ? 1 : 0) + (hasErrorCB ? 1 : 0);
|
||||
var args = slice.call(arguments, 0, arguments.length - numCBs);
|
||||
var onSucc = hasSuccCB ? lastArg : null;
|
||||
var onFail = hasErrorCB ? secondLastArg : null;
|
||||
return messageQueue.call(moduleName, memberName, args, onFail, onSucc);
|
||||
};
|
||||
});
|
||||
@ -92,8 +65,6 @@ var BatchedBridgeFactory = {
|
||||
invokeCallbackAndReturnFlushedQueue:
|
||||
messageQueue.invokeCallbackAndReturnFlushedQueue.bind(messageQueue),
|
||||
flushedQueue: messageQueue.flushedQueue.bind(messageQueue),
|
||||
// These deprecated modules do not accept an error callback.
|
||||
RemoteModulesDeprecated: mapObject(modulesConfig, this._createDeprecatedBridgedModule.bind(this, messageQueue)),
|
||||
RemoteModules: mapObject(modulesConfig, this._createBridgedModule.bind(this, messageQueue)),
|
||||
setLoggingEnabled: messageQueue.setLoggingEnabled.bind(messageQueue),
|
||||
getLoggedOutgoingItems: messageQueue.getLoggedOutgoingItems.bind(messageQueue),
|
||||
|
@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
var ReactPropTypes = require('ReactPropTypes');
|
||||
var RKCameraRollManager = require('NativeModules').RKCameraRollManager;
|
||||
var RCTCameraRollManager = require('NativeModules').RCTCameraRollManager;
|
||||
|
||||
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
||||
var deepFreezeAndThrowOnMutationInDev =
|
||||
@ -98,7 +98,7 @@ class CameraRoll {
|
||||
typeof tag === 'string',
|
||||
'CameraRoll.saveImageWithTag tag must be a valid string.'
|
||||
);
|
||||
RKCameraRollManager.saveImageWithTag(
|
||||
RCTCameraRollManager.saveImageWithTag(
|
||||
tag,
|
||||
(imageTag) => {
|
||||
successCallback && successCallback(imageTag);
|
||||
@ -140,7 +140,7 @@ class CameraRoll {
|
||||
callback(response);
|
||||
};
|
||||
}
|
||||
RKCameraRollManager.getPhotos(params, metaCallback, errorCallback);
|
||||
RCTCameraRollManager.getPhotos(params, metaCallback, errorCallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ var ActivityIndicatorIOS = React.createClass({
|
||||
|
||||
render: function() {
|
||||
var style = styles.sizeSmall;
|
||||
var NativeConstants = NativeModules.RKUIManager.UIActivityIndicatorView.Constants;
|
||||
var NativeConstants = NativeModules.RCTUIManager.UIActivityIndicatorView.Constants;
|
||||
var activityIndicatorViewStyle = NativeConstants.StyleWhite;
|
||||
if (this.props.size === 'large') {
|
||||
style = styles.sizeLarge;
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @providesModule DatePickerIOS
|
||||
*
|
||||
* This is a controlled component version of RKDatePickerIOS
|
||||
* This is a controlled component version of RCTDatePickerIOS
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -11,7 +11,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var PropTypes = require('ReactPropTypes');
|
||||
var React = require('React');
|
||||
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
||||
var RKDatePickerIOSConsts = require('NativeModules').RKUIManager.RCTDatePicker.Constants;
|
||||
var RCTDatePickerIOSConsts = require('NativeModules').RCTUIManager.RCTDatePicker.Constants;
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var View = require('View');
|
||||
|
||||
@ -65,7 +65,7 @@ var DatePickerIOS = React.createClass({
|
||||
*
|
||||
* Valid modes on iOS are: 'date', 'time', 'datetime'.
|
||||
*/
|
||||
mode: PropTypes.oneOf(Object.keys(RKDatePickerIOSConsts.DatePickerModes)),
|
||||
mode: PropTypes.oneOf(Object.keys(RCTDatePickerIOSConsts.DatePickerModes)),
|
||||
|
||||
/**
|
||||
* The interval at which minutes can be selected.
|
||||
@ -111,7 +111,7 @@ var DatePickerIOS = React.createClass({
|
||||
var props = this.props;
|
||||
return (
|
||||
<View style={props.style}>
|
||||
<RKDatePickerIOS
|
||||
<RCTDatePickerIOS
|
||||
ref={DATEPICKER}
|
||||
style={styles.rkDatePickerIOS}
|
||||
date={props.date.getTime()}
|
||||
@ -121,7 +121,7 @@ var DatePickerIOS = React.createClass({
|
||||
minimumDate={
|
||||
props.minimumDate ? props.minimumDate.getTime() : undefined
|
||||
}
|
||||
mode={RKDatePickerIOSConsts.DatePickerModes[props.mode]}
|
||||
mode={RCTDatePickerIOSConsts.DatePickerModes[props.mode]}
|
||||
minuteInterval={props.minuteInterval}
|
||||
timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
|
||||
onChange={this._onChange}
|
||||
@ -133,8 +133,8 @@ var DatePickerIOS = React.createClass({
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
rkDatePickerIOS: {
|
||||
height: RKDatePickerIOSConsts.ComponentHeight,
|
||||
width: RKDatePickerIOSConsts.ComponentWidth,
|
||||
height: RCTDatePickerIOSConsts.ComponentHeight,
|
||||
width: RCTDatePickerIOSConsts.ComponentWidth,
|
||||
},
|
||||
});
|
||||
|
||||
@ -147,7 +147,7 @@ var rkDatePickerIOSAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
timeZoneOffsetInMinutes: true,
|
||||
});
|
||||
|
||||
var RKDatePickerIOS = createReactIOSNativeComponentClass({
|
||||
var RCTDatePickerIOS = createReactIOSNativeComponentClass({
|
||||
validAttributes: rkDatePickerIOSAttributes,
|
||||
uiViewClassName: 'RCTDatePicker',
|
||||
});
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
var ListViewDataSource = require('ListViewDataSource');
|
||||
var React = require('React');
|
||||
var RKUIManager = require('NativeModules').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
var ScrollView = require('ScrollView');
|
||||
var ScrollResponder = require('ScrollResponder');
|
||||
var StaticRenderer = require('StaticRenderer');
|
||||
@ -323,13 +323,13 @@ var ListView = React.createClass({
|
||||
*/
|
||||
|
||||
_measureAndUpdateScrollProps: function() {
|
||||
RKUIManager.measureLayout(
|
||||
RCTUIManager.measureLayout(
|
||||
this.refs[SCROLLVIEW_REF].getInnerViewNode(),
|
||||
this.refs[SCROLLVIEW_REF].getNodeHandle(),
|
||||
logError,
|
||||
this._setScrollContentHeight
|
||||
);
|
||||
RKUIManager.measureLayoutRelativeToParent(
|
||||
RCTUIManager.measureLayoutRelativeToParent(
|
||||
this.refs[SCROLLVIEW_REF].getNodeHandle(),
|
||||
logError,
|
||||
this._setScrollVisibleHeight
|
||||
|
@ -126,7 +126,7 @@ var MapView = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<RKMap
|
||||
<RCTMap
|
||||
style={this.props.style}
|
||||
showsUserLocation={this.props.showsUserLocation}
|
||||
zoomEnabled={this.props.zoomEnabled}
|
||||
@ -145,7 +145,7 @@ var MapView = React.createClass({
|
||||
|
||||
});
|
||||
|
||||
var RKMap = createReactIOSNativeComponentClass({
|
||||
var RCTMap = createReactIOSNativeComponentClass({
|
||||
validAttributes: merge(
|
||||
ReactIOSViewAttributes.UIView, {
|
||||
showsUserLocation: true,
|
||||
|
@ -8,7 +8,7 @@
|
||||
var EventEmitter = require('EventEmitter');
|
||||
var React = require('React');
|
||||
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
||||
var { RKNavigatorManager } = require('NativeModules');
|
||||
var { RCTNavigatorManager } = require('NativeModules');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var StaticContainer = require('StaticContainer.react');
|
||||
var View = require('View');
|
||||
@ -28,14 +28,14 @@ function getuid() {
|
||||
return __uid++;
|
||||
}
|
||||
|
||||
var RKNavigator = createReactIOSNativeComponentClass({
|
||||
var RCTNavigator = createReactIOSNativeComponentClass({
|
||||
validAttributes: merge(ReactIOSViewAttributes.UIView, {
|
||||
requestedTopOfStack: true
|
||||
}),
|
||||
uiViewClassName: 'RCTNavigator',
|
||||
});
|
||||
|
||||
var RKNavigatorItem = createReactIOSNativeComponentClass({
|
||||
var RCTNavigatorItem = createReactIOSNativeComponentClass({
|
||||
validAttributes: {
|
||||
// TODO: Remove or fix the attributes that are not fully functional.
|
||||
// NavigatorIOS does not use them all, because some are problematic
|
||||
@ -53,7 +53,7 @@ var RKNavigatorItem = createReactIOSNativeComponentClass({
|
||||
|
||||
var NavigatorTransitionerIOS = React.createClass({
|
||||
requestSchedulingNavigation: function(cb) {
|
||||
RKNavigatorManager.requestSchedulingJavaScriptNavigation(
|
||||
RCTNavigatorManager.requestSchedulingJavaScriptNavigation(
|
||||
this.getNodeHandle(),
|
||||
logError,
|
||||
cb
|
||||
@ -62,7 +62,7 @@ var NavigatorTransitionerIOS = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<RKNavigator {...this.props}/>
|
||||
<RCTNavigator {...this.props}/>
|
||||
);
|
||||
},
|
||||
});
|
||||
@ -70,12 +70,12 @@ var NavigatorTransitionerIOS = React.createClass({
|
||||
|
||||
/**
|
||||
* Think of `<NavigatorIOS>` as simply a component that renders an
|
||||
* `RKNavigator`, and moves the `RKNavigator`'s `requestedTopOfStack` pointer
|
||||
* forward and backward. The `RKNavigator` interprets changes in
|
||||
* `RCTNavigator`, and moves the `RCTNavigator`'s `requestedTopOfStack` pointer
|
||||
* forward and backward. The `RCTNavigator` interprets changes in
|
||||
* `requestedTopOfStack` to be pushes and pops of children that are rendered.
|
||||
* `<NavigatorIOS>` always ensures that whenever the `requestedTopOfStack`
|
||||
* pointer is moved, that we've also rendered enough children so that the
|
||||
* `RKNavigator` can carry out the push/pop with those children.
|
||||
* `RCTNavigator` can carry out the push/pop with those children.
|
||||
* `<NavigatorIOS>` also removes children that will no longer be needed
|
||||
* (after the pop of a child has been fully completed/animated out).
|
||||
*/
|
||||
@ -496,7 +496,7 @@ var NavigatorIOS = React.createClass({
|
||||
|
||||
return (
|
||||
<StaticContainer key={'nav' + i} shouldUpdate={shouldUpdateChild}>
|
||||
<RKNavigatorItem
|
||||
<RCTNavigatorItem
|
||||
title={route.title}
|
||||
style={[
|
||||
styles.stackItem,
|
||||
@ -512,7 +512,7 @@ var NavigatorIOS = React.createClass({
|
||||
route={route}
|
||||
{...route.passProps}
|
||||
/>
|
||||
</RKNavigatorItem>
|
||||
</RCTNavigatorItem>
|
||||
</StaticContainer>
|
||||
);
|
||||
},
|
||||
|
@ -6,14 +6,14 @@
|
||||
'use strict';
|
||||
|
||||
var NativeModules = require('NativeModules');
|
||||
var NativeModulesDeprecated = require('NativeModulesDeprecated');
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var Subscribable = require('Subscribable');
|
||||
var TextInputState = require('TextInputState');
|
||||
|
||||
var RKUIManager = NativeModules.RKUIManager;
|
||||
var RKUIManagerDeprecated = NativeModulesDeprecated.RKUIManager;
|
||||
var RKScrollViewConsts = RKUIManager.RCTScrollView.Constants;
|
||||
var RCTUIManager = NativeModules.RCTUIManager;
|
||||
var RCTUIManagerDeprecated = NativeModules.RCTUIManager;
|
||||
var RCTScrollViewConsts = RCTUIManager.RCTScrollView.Constants;
|
||||
|
||||
var warning = require('warning');
|
||||
|
||||
@ -99,7 +99,7 @@ var IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
|
||||
|
||||
var ScrollResponderMixin = {
|
||||
mixins: [Subscribable.Mixin],
|
||||
statics: RKScrollViewConsts,
|
||||
statics: RCTScrollViewConsts,
|
||||
scrollResponderMixinGetInitialState: function() {
|
||||
return {
|
||||
isTouching: false,
|
||||
@ -336,7 +336,7 @@ var ScrollResponderMixin = {
|
||||
* can also be used to quickly scroll to any element we want to focus
|
||||
*/
|
||||
scrollResponderScrollTo: function(offsetX, offsetY) {
|
||||
RKUIManagerDeprecated.scrollTo(this.getNodeHandle(), offsetX, offsetY);
|
||||
RCTUIManagerDeprecated.scrollTo(this.getNodeHandle(), offsetX, offsetY);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -344,7 +344,7 @@ var ScrollResponderMixin = {
|
||||
* @param {object} rect Should have shape {x, y, w, h}
|
||||
*/
|
||||
scrollResponderZoomTo: function(rect) {
|
||||
RKUIManagerDeprecated.zoomToRect(this.getNodeHandle(), rect);
|
||||
RCTUIManagerDeprecated.zoomToRect(this.getNodeHandle(), rect);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -354,7 +354,7 @@ var ScrollResponderMixin = {
|
||||
*/
|
||||
scrollResponderScrollNativeHandleToKeyboard: function(nodeHandle, additionalOffset) {
|
||||
this.additionalScrollOffset = additionalOffset || 0;
|
||||
RKUIManager.measureLayout(
|
||||
RCTUIManager.measureLayout(
|
||||
nodeHandle,
|
||||
this.getNodeHandle(),
|
||||
this.scrollResponderTextInputFocusError,
|
||||
|
@ -8,12 +8,12 @@
|
||||
var EdgeInsetsPropType = require('EdgeInsetsPropType');
|
||||
var Platform = require('Platform');
|
||||
var PointPropType = require('PointPropType');
|
||||
var RCTScrollView = require('NativeModules').RKUIManager.RCTScrollView;
|
||||
var RCTScrollView = require('NativeModules').RCTUIManager.RCTScrollView;
|
||||
var RCTScrollViewConsts = RCTScrollView.Constants;
|
||||
var React = require('React');
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
var ScrollResponder = require('ScrollResponder');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var StyleSheetPropType = require('StyleSheetPropType');
|
||||
@ -182,7 +182,7 @@ var ScrollView = React.createClass({
|
||||
},
|
||||
|
||||
scrollTo: function(destY, destX) {
|
||||
RKUIManager.scrollTo(
|
||||
RCTUIManager.scrollTo(
|
||||
this.getNodeHandle(),
|
||||
destX || 0,
|
||||
destY || 0
|
||||
|
@ -60,7 +60,7 @@ var Slider = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<RKSlider
|
||||
<RCTSlider
|
||||
style={[styles.slider, this.props.style]}
|
||||
value={this.props.value}
|
||||
onChange={this._onValueChange}
|
||||
@ -75,7 +75,7 @@ var styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
var RKSlider = createReactIOSNativeComponentClass({
|
||||
var RCTSlider = createReactIOSNativeComponentClass({
|
||||
validAttributes: merge(ReactIOSViewAttributes.UIView, {value: true}),
|
||||
uiViewClassName: 'RCTSlider',
|
||||
});
|
||||
|
@ -6,29 +6,29 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var { RKStatusBarManager } = require('NativeModules');
|
||||
var { RCTStatusBarManager } = require('NativeModules');
|
||||
|
||||
var StatusBarIOS = {
|
||||
|
||||
Style: {
|
||||
default: RKStatusBarManager.Style.default,
|
||||
lightContent: RKStatusBarManager.Style.lightContent
|
||||
default: RCTStatusBarManager.Style.default,
|
||||
lightContent: RCTStatusBarManager.Style.lightContent
|
||||
},
|
||||
|
||||
Animation: {
|
||||
none: RKStatusBarManager.Animation.none,
|
||||
fade: RKStatusBarManager.Animation.fade,
|
||||
slide: RKStatusBarManager.Animation.slide,
|
||||
none: RCTStatusBarManager.Animation.none,
|
||||
fade: RCTStatusBarManager.Animation.fade,
|
||||
slide: RCTStatusBarManager.Animation.slide,
|
||||
},
|
||||
|
||||
setStyle(style: number, animated: boolean) {
|
||||
animated = animated || false;
|
||||
RKStatusBarManager.setStyle(style, animated);
|
||||
RCTStatusBarManager.setStyle(style, animated);
|
||||
},
|
||||
|
||||
setHidden(hidden: boolean, animation: number) {
|
||||
animation = animation || StatusBarIOS.Animation.none;
|
||||
RKStatusBarManager.setHidden(hidden, animation);
|
||||
RCTStatusBarManager.setHidden(hidden, animation);
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* RCTDeviceEventEmitter,
|
||||
* 'reachabilityDidChange',
|
||||
* (resp) => resp.network_reachability,
|
||||
* RKReachability.getCurrentReachability
|
||||
* RCTReachability.getCurrentReachability
|
||||
* );
|
||||
*
|
||||
* var myComponent = React.createClass({
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @providesModule SwitchIOS
|
||||
*
|
||||
* This is a controlled component version of RKSwitch.
|
||||
* This is a controlled component version of RCTSwitch.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -80,7 +80,7 @@ var SwitchIOS = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<RKSwitch
|
||||
<RCTSwitch
|
||||
ref={SWITCH}
|
||||
style={[styles.rkSwitch, this.props.style]}
|
||||
enabled={!this.props.disabled}
|
||||
@ -109,7 +109,7 @@ var rkSwitchAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
enabled: true,
|
||||
});
|
||||
|
||||
var RKSwitch = createReactIOSNativeComponentClass({
|
||||
var RCTSwitch = createReactIOSNativeComponentClass({
|
||||
validAttributes: rkSwitchAttributes,
|
||||
uiViewClassName: 'RCTSwitch',
|
||||
});
|
||||
|
@ -14,9 +14,9 @@ var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentC
|
||||
var TabBarIOS = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<RKTabBar style={[styles.tabGroup, this.props.style]}>
|
||||
<RCTTabBar style={[styles.tabGroup, this.props.style]}>
|
||||
{this.props.children}
|
||||
</RKTabBar>
|
||||
</RCTTabBar>
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -31,6 +31,6 @@ var config = {
|
||||
validAttributes: ReactIOSViewAttributes.UIView,
|
||||
uiViewClassName: 'RCTTabBar',
|
||||
};
|
||||
var RKTabBar = createReactIOSNativeComponentClass(config);
|
||||
var RCTTabBar = createReactIOSNativeComponentClass(config);
|
||||
|
||||
module.exports = TabBarIOS;
|
||||
|
@ -58,7 +58,7 @@ var TabBarItemIOS = React.createClass({
|
||||
}
|
||||
|
||||
return (
|
||||
<RKTabBarItem
|
||||
<RCTTabBarItem
|
||||
icon={this.props.icon.uri}
|
||||
selectedIcon={this.props.selectedIcon && this.props.selectedIcon.uri}
|
||||
onPress={this.props.onPress}
|
||||
@ -67,7 +67,7 @@ var TabBarItemIOS = React.createClass({
|
||||
title={this.props.title}
|
||||
style={[styles.tab, this.props.style]}>
|
||||
{tabContents}
|
||||
</RKTabBarItem>
|
||||
</RCTTabBarItem>
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -80,7 +80,7 @@ var styles = StyleSheet.create({
|
||||
}
|
||||
});
|
||||
|
||||
var RKTabBarItem = createReactIOSNativeComponentClass({
|
||||
var RCTTabBarItem = createReactIOSNativeComponentClass({
|
||||
validAttributes: merge(ReactIOSViewAttributes.UIView, {
|
||||
title: true,
|
||||
icon: true,
|
||||
|
@ -8,7 +8,7 @@
|
||||
var DocumentSelectionState = require('DocumentSelectionState');
|
||||
var EventEmitter = require('EventEmitter');
|
||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var RKUIManager = require('NativeModules').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
var PropTypes = require('ReactPropTypes');
|
||||
var React = require('React');
|
||||
var ReactChildren = require('ReactChildren');
|
||||
@ -25,10 +25,10 @@ var getObjectValues = require('getObjectValues');
|
||||
var invariant = require('invariant');
|
||||
var merge = require('merge');
|
||||
|
||||
var autoCapitalizeConsts = RKUIManager.UIText.AutocapitalizationType;
|
||||
var clearButtonModeConsts = RKUIManager.UITextField.clearButtonMode;
|
||||
var autoCapitalizeConsts = RCTUIManager.UIText.AutocapitalizationType;
|
||||
var clearButtonModeConsts = RCTUIManager.UITextField.clearButtonMode;
|
||||
|
||||
var RKTextViewAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
var RCTTextViewAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
autoCorrect: true,
|
||||
autoCapitalize: true,
|
||||
color: true,
|
||||
@ -42,7 +42,7 @@ var RKTextViewAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
text: true,
|
||||
});
|
||||
|
||||
var RKTextFieldAttributes = merge(RKTextViewAttributes, {
|
||||
var RCTTextFieldAttributes = merge(RCTTextViewAttributes, {
|
||||
caretHidden: true,
|
||||
enabled: true,
|
||||
clearButtonMode: true,
|
||||
@ -198,7 +198,7 @@ var TextInput = React.createClass({
|
||||
|
||||
viewConfig: {
|
||||
uiViewClassName: 'RCTTextField',
|
||||
validAttributes: RKTextFieldAttributes,
|
||||
validAttributes: RCTTextFieldAttributes,
|
||||
},
|
||||
|
||||
isFocused: function() {
|
||||
@ -309,7 +309,7 @@ var TextInput = React.createClass({
|
||||
}
|
||||
}
|
||||
textContainer =
|
||||
<RKTextField
|
||||
<RCTTextField
|
||||
ref="input"
|
||||
style={[styles.input, this.props.style]}
|
||||
enabled={this.props.editable}
|
||||
@ -349,7 +349,7 @@ var TextInput = React.createClass({
|
||||
children = [children, this.props.inputView];
|
||||
}
|
||||
textContainer =
|
||||
<RKTextView
|
||||
<RCTTextView
|
||||
ref="input"
|
||||
style={[styles.input, this.props.style]}
|
||||
children={children}
|
||||
@ -428,13 +428,13 @@ var styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
var RKTextView = createReactIOSNativeComponentClass({
|
||||
validAttributes: RKTextViewAttributes,
|
||||
var RCTTextView = createReactIOSNativeComponentClass({
|
||||
validAttributes: RCTTextViewAttributes,
|
||||
uiViewClassName: 'RCTTextView',
|
||||
});
|
||||
|
||||
var RKTextField = createReactIOSNativeComponentClass({
|
||||
validAttributes: RKTextFieldAttributes,
|
||||
var RCTTextField = createReactIOSNativeComponentClass({
|
||||
validAttributes: RCTTextFieldAttributes,
|
||||
uiViewClassName: 'RCTTextField',
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
var TextInputState = {
|
||||
/**
|
||||
@ -33,7 +33,7 @@ var TextInputState = {
|
||||
focusTextInput: function(textFieldID) {
|
||||
if (this._currentlyFocusedID != textFieldID && textFieldID != null) {
|
||||
this._currentlyFocusedID = textFieldID;
|
||||
RKUIManager.focus(textFieldID);
|
||||
RCTUIManager.focus(textFieldID);
|
||||
}
|
||||
},
|
||||
|
||||
@ -45,7 +45,7 @@ var TextInputState = {
|
||||
blurTextInput: function(textFieldID) {
|
||||
if (this._currentlyFocusedID == textFieldID && textFieldID != null) {
|
||||
this._currentlyFocusedID = null;
|
||||
RKUIManager.blur(textFieldID);
|
||||
RCTUIManager.blur(textFieldID);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -118,7 +118,7 @@ var TouchableHighlight = React.createClass({
|
||||
|
||||
viewConfig: {
|
||||
uiViewClassName: 'RCTView',
|
||||
validAttributes: ReactIOSViewAttributes.RKView
|
||||
validAttributes: ReactIOSViewAttributes.RCTView
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ var View = React.createClass({
|
||||
*/
|
||||
viewConfig: {
|
||||
uiViewClassName: 'RCTView',
|
||||
validAttributes: ReactIOSViewAttributes.RKView
|
||||
validAttributes: ReactIOSViewAttributes.RCTView
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
@ -116,7 +116,7 @@ var View = React.createClass({
|
||||
style: stylePropType,
|
||||
|
||||
/**
|
||||
* This is a special performance property exposed by RKView and is useful
|
||||
* This is a special performance property exposed by RCTView and is useful
|
||||
* for scrolling content when there are many subviews, most of which are
|
||||
* offscreen. For this property to be effective, it must be applied to a
|
||||
* view that contains many subviews that extend outside its bound. The
|
||||
@ -127,18 +127,18 @@ var View = React.createClass({
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return <RKView {...this.props} />;
|
||||
return <RCTView {...this.props} />;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
var RKView = createReactIOSNativeComponentClass({
|
||||
validAttributes: ReactIOSViewAttributes.RKView,
|
||||
var RCTView = createReactIOSNativeComponentClass({
|
||||
validAttributes: ReactIOSViewAttributes.RCTView,
|
||||
uiViewClassName: 'RCTView',
|
||||
});
|
||||
RKView.propTypes = View.propTypes;
|
||||
RCTView.propTypes = View.propTypes;
|
||||
|
||||
var ViewToExport = RKView;
|
||||
var ViewToExport = RCTView;
|
||||
if (__DEV__) {
|
||||
ViewToExport = View;
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ var keyMirror = require('keyMirror');
|
||||
var merge = require('merge');
|
||||
|
||||
var PropTypes = React.PropTypes;
|
||||
var RKUIManager = require('NativeModules').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
var RK_WEBVIEW_REF = 'webview';
|
||||
var RCT_WEBVIEW_REF = 'webview';
|
||||
|
||||
var WebViewState = keyMirror({
|
||||
IDLE: null,
|
||||
@ -81,7 +81,7 @@ var WebView = React.createClass({
|
||||
|
||||
var webView =
|
||||
<RCTWebView
|
||||
ref={RK_WEBVIEW_REF}
|
||||
ref={RCT_WEBVIEW_REF}
|
||||
key="webViewKey"
|
||||
style={webViewStyles}
|
||||
url={this.props.url}
|
||||
@ -102,15 +102,15 @@ var WebView = React.createClass({
|
||||
},
|
||||
|
||||
goForward: function() {
|
||||
RKUIManager.webViewGoForward(this.getWebWiewHandle());
|
||||
RCTUIManager.webViewGoForward(this.getWebWiewHandle());
|
||||
},
|
||||
|
||||
goBack: function() {
|
||||
RKUIManager.webViewGoBack(this.getWebWiewHandle());
|
||||
RCTUIManager.webViewGoBack(this.getWebWiewHandle());
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
RKUIManager.webViewReload(this.getWebWiewHandle());
|
||||
RCTUIManager.webViewReload(this.getWebWiewHandle());
|
||||
},
|
||||
|
||||
/**
|
||||
@ -124,7 +124,7 @@ var WebView = React.createClass({
|
||||
},
|
||||
|
||||
getWebWiewHandle: function() {
|
||||
return this.refs[RK_WEBVIEW_REF].getNodeHandle();
|
||||
return this.refs[RCT_WEBVIEW_REF].getNodeHandle();
|
||||
},
|
||||
|
||||
onLoadingStart: function(event) {
|
||||
|
@ -17,9 +17,9 @@ var insetsDiffer = require('insetsDiffer');
|
||||
var merge = require('merge');
|
||||
|
||||
var PropTypes = React.PropTypes;
|
||||
var { RKWebViewManager } = require('NativeModules');
|
||||
var { RCTWebViewManager } = require('NativeModules');
|
||||
|
||||
var RK_WEBVIEW_REF = 'webview';
|
||||
var RCT_WEBVIEW_REF = 'webview';
|
||||
|
||||
var WebViewState = keyMirror({
|
||||
IDLE: null,
|
||||
@ -28,12 +28,12 @@ var WebViewState = keyMirror({
|
||||
});
|
||||
|
||||
var NavigationType = {
|
||||
click: RKWebViewManager.NavigationType.LinkClicked,
|
||||
formsubmit: RKWebViewManager.NavigationType.FormSubmitted,
|
||||
backforward: RKWebViewManager.NavigationType.BackForward,
|
||||
reload: RKWebViewManager.NavigationType.Reload,
|
||||
formresubmit: RKWebViewManager.NavigationType.FormResubmitted,
|
||||
other: RKWebViewManager.NavigationType.Other,
|
||||
click: RCTWebViewManager.NavigationType.LinkClicked,
|
||||
formsubmit: RCTWebViewManager.NavigationType.FormSubmitted,
|
||||
backforward: RCTWebViewManager.NavigationType.BackForward,
|
||||
reload: RCTWebViewManager.NavigationType.Reload,
|
||||
formresubmit: RCTWebViewManager.NavigationType.FormResubmitted,
|
||||
other: RCTWebViewManager.NavigationType.Other,
|
||||
};
|
||||
|
||||
var WebView = React.createClass({
|
||||
@ -79,7 +79,7 @@ var WebView = React.createClass({
|
||||
errorEvent.code,
|
||||
errorEvent.description);
|
||||
} else if (this.state.viewState !== WebViewState.IDLE) {
|
||||
console.error("RKWebView invalid state encountered: " + this.state.loading);
|
||||
console.error('RCTWebView invalid state encountered: ' + this.state.loading);
|
||||
}
|
||||
|
||||
var webViewStyles = [styles.container, this.props.style];
|
||||
@ -91,7 +91,7 @@ var WebView = React.createClass({
|
||||
|
||||
var webView =
|
||||
<RCTWebView
|
||||
ref={RK_WEBVIEW_REF}
|
||||
ref={RCT_WEBVIEW_REF}
|
||||
key="webViewKey"
|
||||
style={webViewStyles}
|
||||
url={this.props.url}
|
||||
@ -112,15 +112,15 @@ var WebView = React.createClass({
|
||||
},
|
||||
|
||||
goForward: function() {
|
||||
RKWebViewManager.goForward(this.getWebWiewHandle());
|
||||
RCTWebViewManager.goForward(this.getWebWiewHandle());
|
||||
},
|
||||
|
||||
goBack: function() {
|
||||
RKWebViewManager.goBack(this.getWebWiewHandle());
|
||||
RCTWebViewManager.goBack(this.getWebWiewHandle());
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
RKWebViewManager.reload(this.getWebWiewHandle());
|
||||
RCTWebViewManager.reload(this.getWebWiewHandle());
|
||||
},
|
||||
|
||||
/**
|
||||
@ -134,7 +134,7 @@ var WebView = React.createClass({
|
||||
},
|
||||
|
||||
getWebWiewHandle: function() {
|
||||
return this.refs[RK_WEBVIEW_REF].getNodeHandle();
|
||||
return this.refs[RCT_WEBVIEW_REF].getNodeHandle();
|
||||
},
|
||||
|
||||
onLoadingStart: function(event) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
var EdgeInsetsPropType = require('EdgeInsetsPropType');
|
||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var NativeModulesDeprecated = require('NativeModulesDeprecated');
|
||||
var NativeModules = require('NativeModules');
|
||||
var PropTypes = require('ReactPropTypes');
|
||||
var ImageResizeMode = require('ImageResizeMode');
|
||||
var ImageStylePropTypes = require('ImageStylePropTypes');
|
||||
@ -108,13 +108,13 @@ var Image = React.createClass({
|
||||
'static image uris cannot start with "http": "' + source.uri + '"'
|
||||
);
|
||||
var isStored = !source.isStatic && !isNetwork;
|
||||
var RawImage = isNetwork ? RKNetworkImage : RKStaticImage;
|
||||
var RawImage = isNetwork ? RCTNetworkImage : RCTStaticImage;
|
||||
|
||||
if (this.props.style && this.props.style.tintColor) {
|
||||
warning(RawImage === RKStaticImage, 'tintColor style only supported on static images.');
|
||||
warning(RawImage === RCTStaticImage, 'tintColor style only supported on static images.');
|
||||
}
|
||||
|
||||
var contentModes = NativeModulesDeprecated.RKUIManager.UIView.ContentMode;
|
||||
var contentModes = NativeModules.RCTUIManager.UIView.ContentMode;
|
||||
var resizeMode;
|
||||
if (style.resizeMode === ImageResizeMode.stretch) {
|
||||
resizeMode = contentModes.ScaleToFill;
|
||||
@ -155,12 +155,12 @@ var CommonImageViewAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
testID: PropTypes.string,
|
||||
});
|
||||
|
||||
var RKStaticImage = createReactIOSNativeComponentClass({
|
||||
var RCTStaticImage = createReactIOSNativeComponentClass({
|
||||
validAttributes: merge(CommonImageViewAttributes, { tintColor: true }),
|
||||
uiViewClassName: 'RCTStaticImage',
|
||||
});
|
||||
|
||||
var RKNetworkImage = createReactIOSNativeComponentClass({
|
||||
var RCTNetworkImage = createReactIOSNativeComponentClass({
|
||||
validAttributes: merge(CommonImageViewAttributes, { defaultImageSrc: true }),
|
||||
uiViewClassName: 'RCTNetworkImageView',
|
||||
});
|
||||
|
@ -60,7 +60,7 @@ function setupDocumentShim() {
|
||||
var sourceMapPromise;
|
||||
|
||||
function handleErrorWithRedBox(e) {
|
||||
var RKExceptionsManager = require('NativeModules').RKExceptionsManager;
|
||||
var RCTExceptionsManager = require('NativeModules').RCTExceptionsManager;
|
||||
var errorToString = require('errorToString');
|
||||
var loadSourceMap = require('loadSourceMap');
|
||||
|
||||
@ -72,13 +72,13 @@ function handleErrorWithRedBox(e) {
|
||||
'\n message: ' + e.message
|
||||
);
|
||||
|
||||
if (RKExceptionsManager) {
|
||||
RKExceptionsManager.reportUnhandledException(e.message, errorToString(e));
|
||||
if (RCTExceptionsManager) {
|
||||
RCTExceptionsManager.reportUnhandledException(e.message, errorToString(e));
|
||||
if (__DEV__) {
|
||||
(sourceMapPromise = sourceMapPromise || loadSourceMap())
|
||||
.then(map => {
|
||||
var prettyStack = errorToString(e, map);
|
||||
RKExceptionsManager.updateExceptionMessage(e.message, prettyStack);
|
||||
RCTExceptionsManager.updateExceptionMessage(e.message, prettyStack);
|
||||
})
|
||||
.then(null, error => {
|
||||
GLOBAL.console.error('#CLOWNTOWN (error while displaying error): ' + error.message);
|
||||
@ -95,7 +95,7 @@ function setupRedBoxErrorHandler() {
|
||||
/**
|
||||
* Sets up a set of window environment wrappers that ensure that the
|
||||
* BatchedBridge is flushed after each tick. In both the case of the
|
||||
* `UIWebView` based `RKJavaScriptCaller` and `RKContextCaller`, we
|
||||
* `UIWebView` based `RCTJavaScriptCaller` and `RCTContextCaller`, we
|
||||
* implement our own custom timing bridge that should be immune to
|
||||
* unexplainably dropped timing signals.
|
||||
*/
|
||||
@ -115,7 +115,7 @@ function setupTimers() {
|
||||
}
|
||||
|
||||
function setupAlert() {
|
||||
var RKAlertManager = require('RKAlertManager');
|
||||
var { RCTAlertManager } = require('NativeModules');
|
||||
if (!GLOBAL.alert) {
|
||||
GLOBAL.alert = function(text) {
|
||||
var alertOpts = {
|
||||
@ -123,7 +123,7 @@ function setupAlert() {
|
||||
message: '' + text,
|
||||
buttons: [{'cancel': 'Okay'}],
|
||||
};
|
||||
RKAlertManager.alertWithArgs(alertOpts, null);
|
||||
RCTAlertManager.alertWithArgs(alertOpts, null);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Note that the module JSTimers is split into two in order to solve a cycle
|
||||
// in dependencies. NativeModules > BatchedBridge > MessageQueue > JSTimersExecution
|
||||
var RKTiming = require('NativeModules').RKTiming;
|
||||
var RCTTiming = require('NativeModules').RCTTiming;
|
||||
var JSTimersExecution = require('JSTimersExecution');
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ var JSTimers = {
|
||||
return func.apply(undefined, args);
|
||||
};
|
||||
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.setTimeout;
|
||||
RKTiming.createTimer(newID, duration, Date.now(), /** recurring */ false);
|
||||
RCTTiming.createTimer(newID, duration, Date.now(), /** recurring */ false);
|
||||
return newID;
|
||||
},
|
||||
|
||||
@ -60,7 +60,7 @@ var JSTimers = {
|
||||
return func.apply(undefined, args);
|
||||
};
|
||||
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.setInterval;
|
||||
RKTiming.createTimer(newID, duration, Date.now(), /** recurring */ true);
|
||||
RCTTiming.createTimer(newID, duration, Date.now(), /** recurring */ true);
|
||||
return newID;
|
||||
},
|
||||
|
||||
@ -90,7 +90,7 @@ var JSTimers = {
|
||||
JSTimersExecution.timerIDs[freeIndex] = newID;
|
||||
JSTimersExecution.callbacks[freeIndex] = func;
|
||||
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.requestAnimationFrame;
|
||||
RKTiming.createTimer(newID, 0, Date.now(), /** recurring */ false);
|
||||
RCTTiming.createTimer(newID, 0, Date.now(), /** recurring */ false);
|
||||
return newID;
|
||||
},
|
||||
|
||||
@ -126,7 +126,7 @@ var JSTimers = {
|
||||
if (index !== -1) {
|
||||
JSTimersExecution._clearIndex(index);
|
||||
if (JSTimersExecution.types[index] !== JSTimersExecution.Type.setImmediate) {
|
||||
RKTiming.deleteTimer(timerID);
|
||||
RCTTiming.deleteTimer(timerID);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var RKReachability = NativeModules.RKReachability;
|
||||
var RCTReachability = NativeModules.RCTReachability;
|
||||
|
||||
var DEVICE_REACHABILITY_EVENT = 'reachabilityDidChange';
|
||||
|
||||
@ -49,7 +49,7 @@ type ChangeEventName = $Enum<{
|
||||
|
||||
var NetInfo = {};
|
||||
|
||||
if (RKReachability) {
|
||||
if (RCTReachability) {
|
||||
var _reachabilitySubscriptions = {};
|
||||
|
||||
NetInfo.reachabilityIOS = {
|
||||
@ -78,7 +78,7 @@ if (RKReachability) {
|
||||
|
||||
fetch: function(): Promise {
|
||||
return new Promise((resolve, reject) => {
|
||||
RKReachability.getCurrentReachability(
|
||||
RCTReachability.getCurrentReachability(
|
||||
(resp) => {
|
||||
resolve(resp.network_reachability);
|
||||
},
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RKDataManager = require('NativeModulesDeprecated').RKDataManager;
|
||||
var RCTDataManager = require('NativeModules').RCTDataManager;
|
||||
|
||||
var crc32 = require('crc32');
|
||||
|
||||
@ -91,7 +91,7 @@ class XMLHttpRequest {
|
||||
}
|
||||
this._sent = true;
|
||||
|
||||
RKDataManager.queryData(
|
||||
RCTDataManager.queryData(
|
||||
'http',
|
||||
JSON.stringify({
|
||||
method: this._method,
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @providesModule PickerIOS
|
||||
*
|
||||
* This is a controlled component version of RKPickerIOS
|
||||
* This is a controlled component version of RCTPickerIOS
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @providesModule PickerIOS
|
||||
*
|
||||
* This is a controlled component version of RKPickerIOS
|
||||
* This is a controlled component version of RCTPickerIOS
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -11,7 +11,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var React = require('React');
|
||||
var ReactChildren = require('ReactChildren');
|
||||
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
||||
var RKPickerIOSConsts = require('NativeModules').RKUIManager.RCTPicker.Constants;
|
||||
var RCTPickerIOSConsts = require('NativeModules').RCTUIManager.RCTPicker.Constants;
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var View = require('View');
|
||||
|
||||
@ -37,7 +37,7 @@ var PickerIOS = React.createClass({
|
||||
this.setState(this._stateFromProps(nextProps));
|
||||
},
|
||||
|
||||
// Translate PickerIOS prop and children into stuff that RKPickerIOS understands.
|
||||
// Translate PickerIOS prop and children into stuff that RCTPickerIOS understands.
|
||||
_stateFromProps: function(props) {
|
||||
var selectedIndex = 0;
|
||||
var items = [];
|
||||
@ -53,7 +53,7 @@ var PickerIOS = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<View style={this.props.style}>
|
||||
<RKPickerIOS
|
||||
<RCTPickerIOS
|
||||
ref={PICKER}
|
||||
style={styles.rkPickerIOS}
|
||||
items={this.state.items}
|
||||
@ -103,7 +103,7 @@ var styles = StyleSheet.create({
|
||||
// The picker will conform to whatever width is given, but we do
|
||||
// have to set the component's height explicitly on the
|
||||
// surrounding view to ensure it gets rendered.
|
||||
height: RKPickerIOSConsts.ComponentHeight,
|
||||
height: RCTPickerIOSConsts.ComponentHeight,
|
||||
},
|
||||
});
|
||||
|
||||
@ -112,7 +112,7 @@ var rkPickerIOSAttributes = merge(ReactIOSViewAttributes.UIView, {
|
||||
selectedIndex: true,
|
||||
});
|
||||
|
||||
var RKPickerIOS = createReactIOSNativeComponentClass({
|
||||
var RCTPickerIOS = createReactIOSNativeComponentClass({
|
||||
validAttributes: rkPickerIOSAttributes,
|
||||
uiViewClassName: 'RCTPicker',
|
||||
});
|
||||
|
@ -7,7 +7,7 @@
|
||||
#import "RCTTestModule.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
#define TIMEOUT_SECONDS 30
|
||||
#define TIMEOUT_SECONDS 240
|
||||
|
||||
@implementation RCTTestRunner
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
/**
|
||||
* Queries the layout of a view. The layout does not reflect the element as
|
||||
@ -29,7 +29,7 @@ var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
*/
|
||||
var queryLayoutByID = function(rootNodeID, onError, onSuccess) {
|
||||
// Native bridge doesn't *yet* surface errors.
|
||||
RKUIManager.measure(
|
||||
RCTUIManager.measure(
|
||||
ReactIOSTagHandles.rootNodeIDToTag[rootNodeID],
|
||||
onSuccess
|
||||
);
|
||||
|
@ -7,16 +7,16 @@
|
||||
"use strict";
|
||||
|
||||
var EventPropagators = require('EventPropagators');
|
||||
var NativeModulesDeprecated = require('NativeModulesDeprecated');
|
||||
var NativeModules = require('NativeModules');
|
||||
var SyntheticEvent = require('SyntheticEvent');
|
||||
|
||||
var merge = require('merge');
|
||||
var warning = require('warning');
|
||||
|
||||
var RKUIManager = NativeModulesDeprecated.RKUIManager;
|
||||
var RCTUIManager = NativeModules.RCTUIManager;
|
||||
|
||||
var customBubblingEventTypes = RKUIManager.customBubblingEventTypes;
|
||||
var customDirectEventTypes = RKUIManager.customDirectEventTypes;
|
||||
var customBubblingEventTypes = RCTUIManager.customBubblingEventTypes;
|
||||
var customDirectEventTypes = RCTUIManager.customDirectEventTypes;
|
||||
|
||||
var allTypesByEventName = {};
|
||||
|
||||
|
@ -6,10 +6,9 @@
|
||||
'use strict';
|
||||
|
||||
var NativeModules = require('NativeModules');
|
||||
var NativeModulesDeprecated = require('NativeModulesDeprecated');
|
||||
var RKUIManager = NativeModules.RKUIManager;
|
||||
var RKUIManagerDeprecated = NativeModulesDeprecated.RKUIManager;
|
||||
var RKPOPAnimationManagerDeprecated = NativeModulesDeprecated.RKPOPAnimationManager;
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTPOPAnimationManager = NativeModules.RCTPOPAnimationManager;
|
||||
var RCTUIManager = NativeModules.RCTUIManager;
|
||||
var TextInputState = require('TextInputState');
|
||||
|
||||
var flattenStyle = require('flattenStyle');
|
||||
@ -27,20 +26,20 @@ var animationIDInvariant = function(funcName, anim) {
|
||||
var NativeMethodsMixin = {
|
||||
addAnimation: function(anim, callback) {
|
||||
animationIDInvariant('addAnimation', anim);
|
||||
RKPOPAnimationManagerDeprecated.addAnimation(this.getNodeHandle(), anim, callback);
|
||||
RCTPOPAnimationManager.addAnimation(this.getNodeHandle(), anim, callback);
|
||||
},
|
||||
|
||||
removeAnimation: function(anim) {
|
||||
animationIDInvariant('removeAnimation', anim);
|
||||
RKPOPAnimationManagerDeprecated.removeAnimation(this.getNodeHandle(), anim);
|
||||
RCTPOPAnimationManager.removeAnimation(this.getNodeHandle(), anim);
|
||||
},
|
||||
|
||||
measure: function(callback) {
|
||||
RKUIManagerDeprecated.measure(this.getNodeHandle(), callback);
|
||||
RCTUIManager.measure(this.getNodeHandle(), callback);
|
||||
},
|
||||
|
||||
measureLayout: function(relativeToNativeNode, onSuccess, onFail) {
|
||||
RKUIManager.measureLayout(
|
||||
RCTUIManager.measureLayout(
|
||||
this.getNodeHandle(),
|
||||
relativeToNativeNode,
|
||||
onFail,
|
||||
@ -77,7 +76,7 @@ var NativeMethodsMixin = {
|
||||
props = mergeFast(nativeProps, style);
|
||||
}
|
||||
|
||||
RKUIManagerDeprecated.updateView(
|
||||
RCTUIManager.updateView(
|
||||
this.getNodeHandle(),
|
||||
this.viewConfig.uiViewClassName,
|
||||
props
|
||||
|
@ -4,12 +4,9 @@
|
||||
* @providesModule ReactIOSComponentEnvironment
|
||||
*/
|
||||
'use strict';
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
|
||||
var ReactIOSDOMIDOperations = require('ReactIOSDOMIDOperations');
|
||||
var ReactIOSReconcileTransaction = require('ReactIOSReconcileTransaction');
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var ReactPerf = require('ReactPerf');
|
||||
|
||||
var ReactIOSComponentEnvironment = {
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
var ReactPerf = require('ReactPerf');
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ var dangerouslyProcessChildrenUpdates = function(childrenUpdates, markupList) {
|
||||
for (var updateParentTagString in byContainerTag) {
|
||||
var updateParentTagNumber = +updateParentTagString;
|
||||
var childUpdatesToSend = byContainerTag[updateParentTagNumber];
|
||||
RKUIManager.manageChildren(
|
||||
RCTUIManager.manageChildren(
|
||||
updateParentTagNumber,
|
||||
childUpdatesToSend.moveFromIndices,
|
||||
childUpdatesToSend.moveToIndices,
|
||||
@ -89,7 +89,7 @@ var ReactIOSDOMIDOperations = {
|
||||
'dangerouslyReplaceNodeWithMarkupByID',
|
||||
function(id, mountImage) {
|
||||
var oldTag = ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(id);
|
||||
RKUIManager.replaceExistingNonRootView(oldTag, mountImage.tag);
|
||||
RCTUIManager.replaceExistingNonRootView(oldTag, mountImage.tag);
|
||||
ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle(id, mountImage.tag);
|
||||
}
|
||||
),
|
||||
|
@ -3,17 +3,17 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RKUIManager = require('NativeModules').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
|
||||
var ReactIOSGlobalResponderHandler = {
|
||||
onChange: function(from, to) {
|
||||
if (to !== null) {
|
||||
RKUIManager.setJSResponder(
|
||||
RCTUIManager.setJSResponder(
|
||||
ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(to)
|
||||
);
|
||||
} else {
|
||||
RKUIManager.clearJSResponder();
|
||||
RCTUIManager.clearJSResponder();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var ReactPerf = require('ReactPerf');
|
||||
@ -128,7 +128,7 @@ var ReactIOSMount = {
|
||||
);
|
||||
var addChildTags = [mountImage.tag];
|
||||
var addAtIndices = [0];
|
||||
RKUIManager.manageChildren(
|
||||
RCTUIManager.manageChildren(
|
||||
ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID),
|
||||
null, // moveFromIndices
|
||||
null, // moveToIndices
|
||||
@ -150,7 +150,7 @@ var ReactIOSMount = {
|
||||
unmountComponentAtNodeAndRemoveContainer: function(containerTag) {
|
||||
ReactIOSMount.unmountComponentAtNode(containerTag);
|
||||
// call back into native to remove all of the subviews from this container
|
||||
RKUIManager.removeRootView(containerTag);
|
||||
RCTUIManager.removeRootView(containerTag);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -190,7 +190,7 @@ var ReactIOSMount = {
|
||||
instance.unmountComponent();
|
||||
var containerTag =
|
||||
ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID);
|
||||
RKUIManager.removeSubviewsFromContainerWithID(containerTag);
|
||||
RCTUIManager.removeSubviewsFromContainerWithID(containerTag);
|
||||
},
|
||||
|
||||
getNode: function(id) {
|
||||
|
@ -11,7 +11,7 @@ var ReactIOSEventEmitter = require('ReactIOSEventEmitter');
|
||||
var ReactIOSStyleAttributes = require('ReactIOSStyleAttributes');
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var ReactMultiChild = require('ReactMultiChild');
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
var styleDiffer = require('styleDiffer');
|
||||
var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev');
|
||||
@ -109,7 +109,7 @@ ReactIOSNativeComponent.Mixin = {
|
||||
);
|
||||
createdTags[i] = mountImage.tag;
|
||||
}
|
||||
RKUIManager
|
||||
RCTUIManager
|
||||
.manageChildren(containerTag, null, null, createdTags, indexes, null);
|
||||
}
|
||||
},
|
||||
@ -180,7 +180,7 @@ ReactIOSNativeComponent.Mixin = {
|
||||
);
|
||||
|
||||
if (updatePayload) {
|
||||
RKUIManager.updateView(
|
||||
RCTUIManager.updateView(
|
||||
ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(this._rootNodeID),
|
||||
this.viewConfig.uiViewClassName,
|
||||
updatePayload
|
||||
@ -237,7 +237,7 @@ ReactIOSNativeComponent.Mixin = {
|
||||
this._currentElement.props, // next props
|
||||
this.viewConfig.validAttributes
|
||||
);
|
||||
RKUIManager.createView(tag, this.viewConfig.uiViewClassName, updatePayload);
|
||||
RCTUIManager.createView(tag, this.viewConfig.uiViewClassName, updatePayload);
|
||||
|
||||
this._registerListenersUponCreation(this._currentElement.props);
|
||||
this.initializeChildren(
|
||||
|
@ -7,7 +7,7 @@
|
||||
'use strict';
|
||||
|
||||
var ReactIOSTagHandles = require('ReactIOSTagHandles');
|
||||
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
|
||||
var RCTUIManager = require('NativeModules').RCTUIManager;
|
||||
|
||||
var assign = require('Object.assign');
|
||||
|
||||
@ -27,7 +27,7 @@ assign(ReactIOSTextComponent.prototype, {
|
||||
mountComponent: function(rootID, transaction, context) {
|
||||
this._rootNodeID = rootID;
|
||||
var tag = ReactIOSTagHandles.allocateTag();
|
||||
RKUIManager.createView(tag, 'RCTRawText', {text: this._stringText});
|
||||
RCTUIManager.createView(tag, 'RCTRawText', {text: this._stringText});
|
||||
return {
|
||||
rootNodeID: rootID,
|
||||
tag: tag,
|
||||
@ -40,7 +40,7 @@ assign(ReactIOSTextComponent.prototype, {
|
||||
var nextStringText = '' + nextText;
|
||||
if (nextStringText !== this._stringText) {
|
||||
this._stringText = nextStringText;
|
||||
RKUIManager.updateView(
|
||||
RCTUIManager.updateView(
|
||||
ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(
|
||||
this._rootNodeID
|
||||
),
|
||||
|
@ -17,10 +17,10 @@ ReactIOSViewAttributes.UIView = {
|
||||
testID: true,
|
||||
};
|
||||
|
||||
ReactIOSViewAttributes.RKView = merge(
|
||||
ReactIOSViewAttributes.RCTView = merge(
|
||||
ReactIOSViewAttributes.UIView, {
|
||||
|
||||
// This is a special performance property exposed by RKView and useful for
|
||||
// This is a special performance property exposed by RCTView and useful for
|
||||
// scrolling content when there are many subviews, most of which are offscreen.
|
||||
// For this property to be effective, it must be applied to a view that contains
|
||||
// many subviews that extend outside its bound. The subviews must also have
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var PushNotificationIOS = require('PushNotificationIOS');
|
||||
var React = require('React');
|
||||
|
||||
var invariant = require('invariant');
|
||||
@ -15,10 +14,8 @@ function renderApplication(RootComponent, initialProps, rootTag) {
|
||||
rootTag,
|
||||
'Expect to have a valid rootTag, instead got ', rootTag
|
||||
);
|
||||
var initialNotification = PushNotificationIOS.popInitialNotification();
|
||||
React.render(
|
||||
React.render(
|
||||
<RootComponent
|
||||
pushNotification={initialNotification}
|
||||
{...initialProps}
|
||||
/>,
|
||||
rootTag
|
||||
|
@ -6,12 +6,12 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var NativeModules = require('NativeModulesDeprecated');
|
||||
var RKAsyncLocalStorage = NativeModules.RKAsyncLocalStorage;
|
||||
var RKAsyncRocksDBStorage = NativeModules.RKAsyncRocksDBStorage;
|
||||
var NativeModules = require('NativeModules');
|
||||
var RCTAsyncLocalStorage = NativeModules.RCTAsyncLocalStorage;
|
||||
var RCTAsyncRocksDBStorage = NativeModules.RCTAsyncRocksDBStorage;
|
||||
|
||||
// We use RocksDB if available.
|
||||
var RKAsyncStorage = RKAsyncRocksDBStorage || RKAsyncLocalStorage;
|
||||
var RCTAsyncStorage = RCTAsyncRocksDBStorage || RCTAsyncLocalStorage;
|
||||
|
||||
/**
|
||||
* AsyncStorage is a simple, asynchronous, persistent, global, key-value storage
|
||||
@ -33,7 +33,7 @@ var AsyncStorage = {
|
||||
key: string,
|
||||
callback: (error: ?Error, result: ?string) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiGet([key], function(errors, result) {
|
||||
RCTAsyncStorage.multiGet([key], function(errors, result) {
|
||||
// Unpack result to get value from [[key,value]]
|
||||
var value = (result && result[0] && result[0][1]) ? result[0][1] : null;
|
||||
callback((errors && convertError(errors[0])) || null, value);
|
||||
@ -49,7 +49,7 @@ var AsyncStorage = {
|
||||
value: string,
|
||||
callback: ?(error: ?Error) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiSet([[key,value]], function(errors) {
|
||||
RCTAsyncStorage.multiSet([[key,value]], function(errors) {
|
||||
callback && callback((errors && convertError(errors[0])) || null);
|
||||
});
|
||||
},
|
||||
@ -58,7 +58,7 @@ var AsyncStorage = {
|
||||
key: string,
|
||||
callback: ?(error: ?Error) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiRemove([key], function(errors) {
|
||||
RCTAsyncStorage.multiRemove([key], function(errors) {
|
||||
callback && callback((errors && convertError(errors[0])) || null);
|
||||
});
|
||||
},
|
||||
@ -73,7 +73,7 @@ var AsyncStorage = {
|
||||
value: string,
|
||||
callback: ?(error: ?Error) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiMerge([[key,value]], function(errors) {
|
||||
RCTAsyncStorage.multiMerge([[key,value]], function(errors) {
|
||||
callback && callback((errors && convertError(errors[0])) || null);
|
||||
});
|
||||
},
|
||||
@ -84,7 +84,7 @@ var AsyncStorage = {
|
||||
* own keys instead.
|
||||
*/
|
||||
clear: function(callback: ?(error: ?Error) => void) {
|
||||
RKAsyncStorage.clear(function(error) {
|
||||
RCTAsyncStorage.clear(function(error) {
|
||||
callback && callback(convertError(error));
|
||||
});
|
||||
},
|
||||
@ -93,7 +93,7 @@ var AsyncStorage = {
|
||||
* Gets *all* keys known to the system, for all callers, libraries, etc.
|
||||
*/
|
||||
getAllKeys: function(callback: (error: ?Error) => void) {
|
||||
RKAsyncStorage.getAllKeys(function(error, keys) {
|
||||
RCTAsyncStorage.getAllKeys(function(error, keys) {
|
||||
callback(convertError(error), keys);
|
||||
});
|
||||
},
|
||||
@ -118,7 +118,7 @@ var AsyncStorage = {
|
||||
keys: Array<string>,
|
||||
callback: (errors: ?Array<Error>, result: ?Array<Array<string>>) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiGet(keys, function(errors, result) {
|
||||
RCTAsyncStorage.multiGet(keys, function(errors, result) {
|
||||
callback(
|
||||
(errors && errors.map((error) => convertError(error))) || null,
|
||||
result
|
||||
@ -136,7 +136,7 @@ var AsyncStorage = {
|
||||
keyValuePairs: Array<Array<string>>,
|
||||
callback: ?(errors: ?Array<Error>) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiSet(keyValuePairs, function(errors) {
|
||||
RCTAsyncStorage.multiSet(keyValuePairs, function(errors) {
|
||||
callback && callback(
|
||||
(errors && errors.map((error) => convertError(error))) || null
|
||||
);
|
||||
@ -150,7 +150,7 @@ var AsyncStorage = {
|
||||
keys: Array<string>,
|
||||
callback: ?(errors: ?Array<Error>) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiRemove(keys, function(errors) {
|
||||
RCTAsyncStorage.multiRemove(keys, function(errors) {
|
||||
callback && callback(
|
||||
(errors && errors.map((error) => convertError(error))) || null
|
||||
);
|
||||
@ -167,7 +167,7 @@ var AsyncStorage = {
|
||||
keyValuePairs: Array<Array<string>>,
|
||||
callback: ?(errors: ?Array<Error>) => void
|
||||
): void {
|
||||
RKAsyncStorage.multiMerge(keyValuePairs, function(errors) {
|
||||
RCTAsyncStorage.multiMerge(keyValuePairs, function(errors) {
|
||||
callback && callback(
|
||||
(errors && errors.map((error) => convertError(error))) || null
|
||||
);
|
||||
@ -176,7 +176,7 @@ var AsyncStorage = {
|
||||
};
|
||||
|
||||
// Not all native implementations support merge.
|
||||
if (!RKAsyncStorage.multiMerge) {
|
||||
if (!RCTAsyncStorage.multiMerge) {
|
||||
delete AsyncStorage.mergeItem;
|
||||
delete AsyncStorage.multiMerge;
|
||||
}
|
||||
|
@ -5,19 +5,15 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var ImageStylePropTypes = require('ImageStylePropTypes');
|
||||
var ReactPropTypeLocations = require('ReactPropTypeLocations');
|
||||
var StyleSheetRegistry = require('StyleSheetRegistry');
|
||||
var TextStylePropTypes = require('TextStylePropTypes');
|
||||
var ViewStylePropTypes = require('ViewStylePropTypes');
|
||||
|
||||
var invariant = require('invariant');
|
||||
var StyleSheetValidation = require('StyleSheetValidation');
|
||||
|
||||
/**
|
||||
* A StyleSheet is an abstraction similar to CSS StyleSheets
|
||||
*
|
||||
* Create a new StyleSheet:
|
||||
*
|
||||
* ```
|
||||
* var styles = StyleSheet.create({
|
||||
* container: {
|
||||
* borderRadius: 4,
|
||||
@ -31,21 +27,26 @@ var invariant = require('invariant');
|
||||
* activeTitle: {
|
||||
* color: 'red',
|
||||
* },
|
||||
* })
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Use a StyleSheet:
|
||||
*
|
||||
* ```
|
||||
* <View style={styles.container}>
|
||||
* <Text style={[styles.title, this.props.isActive && styles.activeTitle]} />
|
||||
* </View>
|
||||
* ```
|
||||
*
|
||||
* Code quality:
|
||||
*
|
||||
* - By moving styles away from the render function, you're making the code
|
||||
* code easier to understand.
|
||||
* - Naming the styles is a good way to add meaning to the low level components
|
||||
* in the render function.
|
||||
*
|
||||
* Performance:
|
||||
*
|
||||
* - Making a stylesheet from a style object makes it possible to refer to it
|
||||
* by ID instead of creating a new style object every time.
|
||||
* - It also allows to send the style only once through the bridge. All
|
||||
@ -55,66 +56,11 @@ class StyleSheet {
|
||||
static create(obj) {
|
||||
var result = {};
|
||||
for (var key in obj) {
|
||||
StyleSheet.validateStyle(key, obj);
|
||||
StyleSheetValidation.validateStyle(key, obj);
|
||||
result[key] = StyleSheetRegistry.registerStyle(obj[key]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static validateStyleProp(prop, style, caller) {
|
||||
if (!__DEV__) {
|
||||
return;
|
||||
}
|
||||
if (allStylePropTypes[prop] === undefined) {
|
||||
var message1 = '"' + prop + '" is not a valid style property.';
|
||||
var message2 = '\nValid style props: ' +
|
||||
JSON.stringify(Object.keys(allStylePropTypes), null, ' ');
|
||||
styleError(message1, style, caller, message2);
|
||||
}
|
||||
var error = allStylePropTypes[prop](
|
||||
style,
|
||||
prop,
|
||||
caller,
|
||||
ReactPropTypeLocations.prop
|
||||
);
|
||||
if (error) {
|
||||
styleError(error.message, style, caller);
|
||||
}
|
||||
}
|
||||
|
||||
static validateStyle(name, styles) {
|
||||
if (!__DEV__) {
|
||||
return;
|
||||
}
|
||||
for (var prop in styles[name]) {
|
||||
StyleSheet.validateStyleProp(prop, styles[name], 'StyleSheet ' + name);
|
||||
}
|
||||
}
|
||||
|
||||
static addValidStylePropTypes(stylePropTypes) {
|
||||
for (var key in stylePropTypes) {
|
||||
invariant(
|
||||
allStylePropTypes[key] === undefined ||
|
||||
allStylePropTypes[key] === stylePropTypes[key],
|
||||
'Attemped to redefine existing style prop type "' + key + '".'
|
||||
);
|
||||
allStylePropTypes[key] = stylePropTypes[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var styleError = function(message1, style, caller, message2) {
|
||||
invariant(
|
||||
false,
|
||||
message1 + '\n' + (caller || '<<unknown>>') + ': ' +
|
||||
JSON.stringify(style, null, ' ') + (message2 || '')
|
||||
);
|
||||
};
|
||||
|
||||
var allStylePropTypes = {};
|
||||
|
||||
StyleSheet.addValidStylePropTypes(ImageStylePropTypes);
|
||||
StyleSheet.addValidStylePropTypes(TextStylePropTypes);
|
||||
StyleSheet.addValidStylePropTypes(ViewStylePropTypes);
|
||||
|
||||
module.exports = StyleSheet;
|
||||
|
72
Libraries/StyleSheet/StyleSheetValidation.js
Normal file
72
Libraries/StyleSheet/StyleSheetValidation.js
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule StyleSheetValidation
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var ImageStylePropTypes = require('ImageStylePropTypes');
|
||||
var ReactPropTypeLocations = require('ReactPropTypeLocations');
|
||||
var TextStylePropTypes = require('TextStylePropTypes');
|
||||
var ViewStylePropTypes = require('ViewStylePropTypes');
|
||||
|
||||
var invariant = require('invariant');
|
||||
|
||||
class StyleSheetValidation {
|
||||
static validateStyleProp(prop, style, caller) {
|
||||
if (!__DEV__) {
|
||||
return;
|
||||
}
|
||||
if (allStylePropTypes[prop] === undefined) {
|
||||
var message1 = '"' + prop + '" is not a valid style property.';
|
||||
var message2 = '\nValid style props: ' +
|
||||
JSON.stringify(Object.keys(allStylePropTypes), null, ' ');
|
||||
styleError(message1, style, caller, message2);
|
||||
}
|
||||
var error = allStylePropTypes[prop](
|
||||
style,
|
||||
prop,
|
||||
caller,
|
||||
ReactPropTypeLocations.prop
|
||||
);
|
||||
if (error) {
|
||||
styleError(error.message, style, caller);
|
||||
}
|
||||
}
|
||||
|
||||
static validateStyle(name, styles) {
|
||||
if (!__DEV__) {
|
||||
return;
|
||||
}
|
||||
for (var prop in styles[name]) {
|
||||
StyleSheetValidation.validateStyleProp(prop, styles[name], 'StyleSheet ' + name);
|
||||
}
|
||||
}
|
||||
|
||||
static addValidStylePropTypes(stylePropTypes) {
|
||||
for (var key in stylePropTypes) {
|
||||
invariant(
|
||||
allStylePropTypes[key] === undefined ||
|
||||
allStylePropTypes[key] === stylePropTypes[key],
|
||||
'Attemped to redefine existing style prop type "' + key + '".'
|
||||
);
|
||||
allStylePropTypes[key] = stylePropTypes[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var styleError = function(message1, style, caller, message2) {
|
||||
invariant(
|
||||
false,
|
||||
message1 + '\n' + (caller || '<<unknown>>') + ': ' +
|
||||
JSON.stringify(style, null, ' ') + (message2 || '')
|
||||
);
|
||||
};
|
||||
|
||||
var allStylePropTypes = {};
|
||||
|
||||
StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes);
|
||||
StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes);
|
||||
StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes);
|
||||
|
||||
module.exports = StyleSheetValidation;
|
@ -23,6 +23,8 @@
|
||||
return [[RCTShadowText alloc] init];
|
||||
}
|
||||
|
||||
#pragma mark - View properties
|
||||
|
||||
RCT_REMAP_VIEW_PROPERTY(containerBackgroundColor, backgroundColor)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(numberOfLines, RCTText)
|
||||
{
|
||||
@ -34,6 +36,8 @@ RCT_CUSTOM_VIEW_PROPERTY(numberOfLines, RCTText)
|
||||
view.lineBreakMode = truncationMode;
|
||||
}
|
||||
|
||||
#pragma mark - Shadow properties
|
||||
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(backgroundColor, RCTShadowText)
|
||||
{
|
||||
view.textBackgroundColor = json ? [RCTConvert UIColor:json] : defaultView.textBackgroundColor;
|
||||
|
@ -184,12 +184,12 @@ var Text = React.createClass({
|
||||
props.onResponderMove = this.handleResponderMove;
|
||||
props.onResponderRelease = this.handleResponderRelease;
|
||||
props.onResponderTerminate = this.handleResponderTerminate;
|
||||
return <RKText {...props} />;
|
||||
return <RCTText {...props} />;
|
||||
},
|
||||
});
|
||||
|
||||
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
|
||||
var RKText = createReactIOSNativeComponentClass(viewConfig);
|
||||
var RCTText = createReactIOSNativeComponentClass(viewConfig);
|
||||
|
||||
module.exports = Text;
|
||||
|
@ -6,9 +6,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var NativeModules = require('NativeModulesDeprecated');
|
||||
|
||||
var RCTAlertManager = NativeModules.RCTAlertManager;
|
||||
var { RCTAlertManager } = require('NativeModules');
|
||||
|
||||
var DEFAULT_BUTTON_TEXT = 'OK';
|
||||
var DEFAULT_BUTTON = {
|
||||
|
@ -9,7 +9,7 @@ var NativeModules = require('NativeModules');
|
||||
|
||||
var invariant = require('invariant');
|
||||
|
||||
var dimensions = NativeModules.RKUIManager.Dimensions;
|
||||
var dimensions = NativeModules.RCTUIManager.Dimensions;
|
||||
|
||||
class Dimensions {
|
||||
/**
|
||||
|
@ -415,28 +415,6 @@ var MessageQueueMixin = {
|
||||
return ret;
|
||||
},
|
||||
|
||||
callDeprecated: function(moduleName, methodName, params, cb, scope) {
|
||||
invariant(
|
||||
!cb || typeof cb === 'function',
|
||||
'Last argument (callback) must be function'
|
||||
);
|
||||
// Store callback _before_ sending the request, just in case the MailBox
|
||||
// returns the response in a blocking manner
|
||||
if (cb) {
|
||||
this._storeCallbacksInCurrentThread(null, cb, scope, this._POOLED_CBIDS);
|
||||
params.push(this._POOLED_CBIDS.successCallbackID);
|
||||
}
|
||||
var moduleID = this._remoteModuleNameToModuleID[moduleName];
|
||||
if (moduleID === undefined || moduleID === null) {
|
||||
throw new Error('Unrecognized module name:' + moduleName);
|
||||
}
|
||||
var methodID = this._remoteModuleNameToMethodNameToID[moduleName][methodName];
|
||||
if (methodID === undefined || moduleID === null) {
|
||||
throw new Error('Unrecognized method name:' + methodName);
|
||||
}
|
||||
this._pushRequestToOutgoingItems(moduleID, methodID, params);
|
||||
},
|
||||
|
||||
call: function(moduleName, methodName, params, onFail, onSucc, scope) {
|
||||
invariant(
|
||||
(!onFail || typeof onFail === 'function') &&
|
||||
@ -445,9 +423,9 @@ var MessageQueueMixin = {
|
||||
);
|
||||
// Store callback _before_ sending the request, just in case the MailBox
|
||||
// returns the response in a blocking manner.
|
||||
if (onFail || onSucc) {
|
||||
if (onSucc) {
|
||||
this._storeCallbacksInCurrentThread(onFail, onSucc, scope, this._POOLED_CBIDS);
|
||||
params.push(this._POOLED_CBIDS.errorCallbackID);
|
||||
onFail && params.push(this._POOLED_CBIDS.errorCallbackID);
|
||||
params.push(this._POOLED_CBIDS.successCallbackID);
|
||||
}
|
||||
var moduleID = this._remoteModuleNameToModuleID[moduleName];
|
||||
|
25
Libraries/Utilities/nativeModulePrefixDuplicator.js
Normal file
25
Libraries/Utilities/nativeModulePrefixDuplicator.js
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule nativeModulePrefixDuplicator
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
// Dirty hack to support old (RK) and new (RCT) native module name conventions
|
||||
function nativeModulePrefixDuplicator(modules) {
|
||||
Object.keys(modules).forEach((moduleName) => {
|
||||
var rkModuleName = moduleName.replace(/^RCT/, 'RK');
|
||||
var rctModuleName = moduleName.replace(/^RK/, 'RCT');
|
||||
if (rkModuleName !== rctModuleName) {
|
||||
if (modules[rkModuleName] && modules[rctModuleName]) {
|
||||
throw new Error(
|
||||
'Module cannot be registered as both RCT and RK: ' + moduleName
|
||||
);
|
||||
}
|
||||
modules[rkModuleName] = modules[moduleName];
|
||||
modules[rctModuleName] = modules[moduleName];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = nativeModulePrefixDuplicator;
|
7
Libraries/Vibration/RCTVibration.h
Normal file
7
Libraries/Vibration/RCTVibration.h
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#import "RCTBridgeModule.h"
|
||||
|
||||
@interface RCTVibration : NSObject <RCTBridgeModule>
|
||||
|
||||
@end
|
15
Libraries/Vibration/RCTVibration.m
Normal file
15
Libraries/Vibration/RCTVibration.m
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#import "RCTVibration.h"
|
||||
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
@implementation RCTVibration
|
||||
|
||||
- (void)vibrate
|
||||
{
|
||||
RCT_EXPORT();
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
}
|
||||
|
||||
@end
|
248
Libraries/Vibration/RCTVibration.xcodeproj/project.pbxproj
Normal file
248
Libraries/Vibration/RCTVibration.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,248 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
832C819C1AAF6E1A007FA2F7 /* RCTVibration.m in Sources */ = {isa = PBXBuildFile; fileRef = 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
832C817E1AAF6DEF007FA2F7 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTVibration.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
832C819A1AAF6E1A007FA2F7 /* RCTVibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVibration.h; sourceTree = "<group>"; };
|
||||
832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVibration.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
832C817D1AAF6DEF007FA2F7 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
832C81771AAF6DEF007FA2F7 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
832C819A1AAF6E1A007FA2F7 /* RCTVibration.h */,
|
||||
832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */,
|
||||
832C81811AAF6DEF007FA2F7 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
832C81811AAF6DEF007FA2F7 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
832C817F1AAF6DEF007FA2F7 /* RCTVibration */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 832C81941AAF6DF0007FA2F7 /* Build configuration list for PBXNativeTarget "RCTVibration" */;
|
||||
buildPhases = (
|
||||
832C817C1AAF6DEF007FA2F7 /* Sources */,
|
||||
832C817D1AAF6DEF007FA2F7 /* Frameworks */,
|
||||
832C817E1AAF6DEF007FA2F7 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = RCTVibration;
|
||||
productName = RCTVibration;
|
||||
productReference = 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
832C81781AAF6DEF007FA2F7 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0620;
|
||||
ORGANIZATIONNAME = Facebook;
|
||||
TargetAttributes = {
|
||||
832C817F1AAF6DEF007FA2F7 = {
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 832C817B1AAF6DEF007FA2F7 /* Build configuration list for PBXProject "RCTVibration" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 832C81771AAF6DEF007FA2F7;
|
||||
productRefGroup = 832C81811AAF6DEF007FA2F7 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
832C817F1AAF6DEF007FA2F7 /* RCTVibration */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
832C817C1AAF6DEF007FA2F7 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
832C819C1AAF6E1A007FA2F7 /* RCTVibration.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
832C81921AAF6DF0007FA2F7 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/../../ReactKit/**",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
832C81931AAF6DF0007FA2F7 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/../../ReactKit/**",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
832C81951AAF6DF0007FA2F7 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
832C81961AAF6DF0007FA2F7 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
832C817B1AAF6DEF007FA2F7 /* Build configuration list for PBXProject "RCTVibration" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
832C81921AAF6DF0007FA2F7 /* Debug */,
|
||||
832C81931AAF6DF0007FA2F7 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
832C81941AAF6DF0007FA2F7 /* Build configuration list for PBXNativeTarget "RCTVibration" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
832C81951AAF6DF0007FA2F7 /* Debug */,
|
||||
832C81961AAF6DF0007FA2F7 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 832C81781AAF6DEF007FA2F7 /* Project object */;
|
||||
}
|
18
Libraries/Vibration/VibrationIOS.android.js
Normal file
18
Libraries/Vibration/VibrationIOS.android.js
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* Stub of VibrationIOS for Android.
|
||||
*
|
||||
* @providesModule VibrationIOS
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var warning = require('warning');
|
||||
|
||||
var VibrationIOS = {
|
||||
vibrate: function() {
|
||||
warning('VibrationIOS is not supported on this platform!');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = VibrationIOS;
|
32
Libraries/Vibration/VibrationIOS.ios.js
Normal file
32
Libraries/Vibration/VibrationIOS.ios.js
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule VibrationIOS
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var {RCTVibration} = require('NativeModules');
|
||||
var invariant = require('invariant');
|
||||
|
||||
/**
|
||||
* The Vibration API is exposed at `VibrationIOS.vibrate()`. On iOS, calling this
|
||||
* function will trigger a one second vibration. The vibration is asynchronous
|
||||
* so this method will return immediately.
|
||||
*
|
||||
* There will be no effect on devices that do not support Vibration, eg. the iOS
|
||||
* simulator.
|
||||
*
|
||||
* Vibration patterns are currently unsupported.
|
||||
*/
|
||||
|
||||
var VibrationIOS = {
|
||||
vibrate: function() {
|
||||
invariant(
|
||||
arguments[0] === undefined,
|
||||
'Vibration patterns not supported.'
|
||||
);
|
||||
RCTVibration.vibrate();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = VibrationIOS;
|
1
Libraries/react-native/react-native.js
vendored
1
Libraries/react-native/react-native.js
vendored
@ -38,6 +38,7 @@ var ReactNative = {
|
||||
TouchableHighlight: require('TouchableHighlight'),
|
||||
TouchableOpacity: require('TouchableOpacity'),
|
||||
TouchableWithoutFeedback: require('TouchableWithoutFeedback'),
|
||||
VibrationIOS: require('VibrationIOS'),
|
||||
View: require('View'),
|
||||
WebView: require('WebView'),
|
||||
invariant: require('invariant'),
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
+ (NSTextAlignment)NSTextAlignment:(id)json;
|
||||
+ (NSWritingDirection)NSWritingDirection:(id)json;
|
||||
+ (UITextAutocapitalizationType)UITextAutocapitalizationType:(id)json;
|
||||
+ (UIKeyboardType)UIKeyboardType:(id)json;
|
||||
|
||||
+ (CGFloat)CGFloat:(id)json;
|
||||
|
@ -85,10 +85,9 @@
|
||||
|
||||
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHidden:(BOOL)shouldShow
|
||||
{
|
||||
_lastStackTrace = stack;
|
||||
_lastErrorMessage = message;
|
||||
|
||||
if (self.hidden && shouldShow) {
|
||||
_lastStackTrace = stack;
|
||||
_lastErrorMessage = message;
|
||||
|
||||
_cachedMessageCell = [self reuseCell:nil forErrorMessage:message];
|
||||
[_stackTraceTableView reloadData];
|
||||
|
@ -718,7 +718,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
|
||||
}
|
||||
|
||||
RCTShadowView *shadowView = [manager shadowView];
|
||||
shadowView.moduleName = viewName;
|
||||
shadowView.viewName = viewName;
|
||||
shadowView.reactTag = reactTag;
|
||||
RCTSetShadowViewProps(props, shadowView, _defaultShadowViews[viewName], manager);
|
||||
_shadowViewRegistry[shadowView.reactTag] = shadowView;
|
||||
@ -973,8 +973,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
|
||||
NSMutableArray *results = [[NSMutableArray alloc] initWithCapacity:[childShadowViews count]];
|
||||
CGRect layoutRect = [RCTConvert CGRect:rect];
|
||||
|
||||
for (int ii = 0; ii < [childShadowViews count]; ii++) {
|
||||
RCTShadowView *childShadowView = [childShadowViews objectAtIndex:ii];
|
||||
[childShadowViews enumerateObjectsUsingBlock:^(RCTShadowView *childShadowView, NSUInteger idx, BOOL *stop) {
|
||||
CGRect childLayout = [RCTShadowView measureLayout:childShadowView relativeTo:shadowView];
|
||||
if (CGRectIsNull(childLayout)) {
|
||||
RCTLogError(@"View %@ (tag #%@) is not a decendant of %@ (tag #%@)",
|
||||
@ -992,7 +991,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
|
||||
topOffset <= layoutRect.origin.y + layoutRect.size.height &&
|
||||
topOffset + height >= layoutRect.origin.y) {
|
||||
// This view is within the layout rect
|
||||
NSDictionary *result = @{@"index": @(ii),
|
||||
NSDictionary *result = @{@"index": @(idx),
|
||||
@"left": @(leftOffset),
|
||||
@"top": @(topOffset),
|
||||
@"width": @(width),
|
||||
@ -1000,7 +999,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
|
||||
|
||||
[results addObject:result];
|
||||
}
|
||||
}
|
||||
}];
|
||||
callback(@[results]);
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "Layout.h"
|
||||
#import "RCTUIManager.h"
|
||||
#import "../Layout/Layout.h"
|
||||
|
||||
#import "RCTViewNodeProtocol.h"
|
||||
|
||||
@class RCTSparseArray;
|
||||
@ -31,7 +31,7 @@ typedef void (^RCTApplierBlock)(RCTSparseArray *);
|
||||
|
||||
@property (nonatomic, weak, readonly) RCTShadowView *superview;
|
||||
@property (nonatomic, assign, readonly) css_node_t *cssNode;
|
||||
@property (nonatomic, copy) NSString *moduleName;
|
||||
@property (nonatomic, copy) NSString *viewName;
|
||||
@property (nonatomic, assign) BOOL isBGColorExplicitlySet; // Used to propagate to children
|
||||
@property (nonatomic, strong) UIColor *backgroundColor; // Used to propagate to children
|
||||
@property (nonatomic, assign) RCTUpdateLifecycle layoutLifecycle;
|
||||
@ -54,6 +54,9 @@ typedef void (^RCTApplierBlock)(RCTSparseArray *);
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat top;
|
||||
@property (nonatomic, assign) CGFloat left;
|
||||
@property (nonatomic, assign) CGFloat bottom;
|
||||
@property (nonatomic, assign) CGFloat right;
|
||||
|
||||
@property (nonatomic, assign) CGFloat width;
|
||||
@property (nonatomic, assign) CGFloat height;
|
||||
@property (nonatomic, assign) CGRect frame;
|
||||
@ -66,8 +69,8 @@ typedef void (^RCTApplierBlock)(RCTSparseArray *);
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat borderTop;
|
||||
@property (nonatomic, assign) CGFloat borderLeft;
|
||||
@property (nonatomic, assign) CGFloat borderWidth;
|
||||
@property (nonatomic, assign) CGFloat borderHeight;
|
||||
@property (nonatomic, assign) CGFloat borderBottom;
|
||||
@property (nonatomic, assign) CGFloat borderRight;
|
||||
|
||||
- (void)setBorderWidth:(CGFloat)value;
|
||||
|
||||
|
@ -44,7 +44,7 @@ typedef enum {
|
||||
static void RCTPrint(void *context)
|
||||
{
|
||||
RCTShadowView *shadowView = (__bridge RCTShadowView *)context;
|
||||
printf("%s(%zd), ", [[shadowView moduleName] UTF8String], [[shadowView reactTag] integerValue]);
|
||||
printf("%s(%zd), ", shadowView.viewName.UTF8String, shadowView.reactTag.integerValue);
|
||||
}
|
||||
|
||||
static css_node_t *RCTGetChild(void *context, int i)
|
||||
@ -132,12 +132,13 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st
|
||||
RCTRoundPixelValue(absolutePosition.y + node->layout.position[CSS_TOP] + node->layout.dimensions[CSS_HEIGHT])
|
||||
};
|
||||
|
||||
CGRect frame = {
|
||||
CGRect frame = {{
|
||||
RCTRoundPixelValue(node->layout.position[CSS_LEFT]),
|
||||
RCTRoundPixelValue(node->layout.position[CSS_TOP]),
|
||||
}, {
|
||||
RCTRoundPixelValue(absoluteBottomRight.x - absoluteTopLeft.x),
|
||||
RCTRoundPixelValue(absoluteBottomRight.y - absoluteTopLeft.y)
|
||||
};
|
||||
}};
|
||||
|
||||
if (!CGRectEqualToRect(frame, _frame)) {
|
||||
_frame = frame;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#import "RCTTextFieldManager.h"
|
||||
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTSparseArray.h"
|
||||
@ -16,20 +17,24 @@
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(caretHidden)
|
||||
RCT_EXPORT_VIEW_PROPERTY(autoCorrect)
|
||||
RCT_REMAP_VIEW_PROPERTY(autoCapitalize, autocapitalizationType)
|
||||
RCT_EXPORT_VIEW_PROPERTY(enabled)
|
||||
RCT_EXPORT_VIEW_PROPERTY(placeholder)
|
||||
RCT_EXPORT_VIEW_PROPERTY(text)
|
||||
RCT_EXPORT_VIEW_PROPERTY(clearButtonMode)
|
||||
RCT_EXPORT_VIEW_PROPERTY(keyboardType)
|
||||
RCT_REMAP_VIEW_PROPERTY(color, textColor)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(autoCapitalize, RCTTextField)
|
||||
{
|
||||
view.autocapitalizationType = json ? [RCTConvert UITextAutocapitalizationType:json]
|
||||
: defaultView.autocapitalizationType;
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(fontSize, RCTTextField)
|
||||
{
|
||||
view.font = [RCTConvert UIFont:view.font withSize:json ?: @(defaultView.font.pointSize)];
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(fontWeight, RCTTextField)
|
||||
{
|
||||
view.font = [RCTConvert UIFont:view.font withWeight:json]; // TODO
|
||||
view.font = [RCTConvert UIFont:view.font withWeight:json]; // TODO: default value
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(fontFamily, RCTTextField)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
// View properties
|
||||
#pragma mark - View properties
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(accessibilityLabel)
|
||||
RCT_EXPORT_VIEW_PROPERTY(hidden)
|
||||
@ -110,7 +110,7 @@ RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTView)
|
||||
}
|
||||
}
|
||||
|
||||
// ShadowView properties
|
||||
#pragma mark - ShadowView properties
|
||||
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(backgroundColor, RCTShadowView)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user