Skip to content

Commit d65a3ad

Browse files
2 parents 1c61a8a + 9f1dab6 commit d65a3ad

File tree

9 files changed

+67
-40
lines changed

9 files changed

+67
-40
lines changed

Examples/UIExplorer/PanResponderExample.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ var PanResponderExample = React.createClass({
5252
this._previousLeft = 20;
5353
this._previousTop = 84;
5454
this._circleStyles = {
55-
left: this._previousLeft,
56-
top: this._previousTop,
55+
style: {
56+
left: this._previousLeft,
57+
top: this._previousTop
58+
}
5759
};
5860
},
5961

@@ -78,13 +80,17 @@ var PanResponderExample = React.createClass({
7880

7981
_highlight: function() {
8082
this.circle && this.circle.setNativeProps({
81-
backgroundColor: processColor(CIRCLE_HIGHLIGHT_COLOR)
83+
style: {
84+
backgroundColor: processColor(CIRCLE_HIGHLIGHT_COLOR)
85+
}
8286
});
8387
},
8488

8589
_unHighlight: function() {
8690
this.circle && this.circle.setNativeProps({
87-
backgroundColor: processColor(CIRCLE_COLOR)
91+
style: {
92+
backgroundColor: processColor(CIRCLE_COLOR)
93+
}
8894
});
8995
},
9096

@@ -106,8 +112,8 @@ var PanResponderExample = React.createClass({
106112
this._highlight();
107113
},
108114
_handlePanResponderMove: function(e: Object, gestureState: Object) {
109-
this._circleStyles.left = this._previousLeft + gestureState.dx;
110-
this._circleStyles.top = this._previousTop + gestureState.dy;
115+
this._circleStyles.style.left = this._previousLeft + gestureState.dx;
116+
this._circleStyles.style.top = this._previousTop + gestureState.dy;
111117
this._updatePosition();
112118
},
113119
_handlePanResponderEnd: function(e: Object, gestureState: Object) {

Libraries/Components/Navigator/NavigatorBreadcrumbNavigationBarStyles.android.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,14 @@ RIGHT[0].Title = merge(FIRST_TITLE_BASE, {opacity: 0});
125125
var buildIndexSceneInterpolator = function(startStyles, endStyles) {
126126
return {
127127
Crumb: buildStyleInterpolator({
128-
translateX: {
128+
left: {
129129
type: 'linear',
130-
from: 0,
131-
to: endStyles.Crumb.left - startStyles.Crumb.left,
130+
from: startStyles.Crumb.left,
131+
to: endStyles.Crumb.left,
132132
min: 0,
133133
max: 1,
134134
extrapolate: true,
135135
},
136-
left: {
137-
value: startStyles.Crumb.left,
138-
type: 'constant'
139-
},
140136
}),
141137
Icon: buildStyleInterpolator({
142138
opacity: {
@@ -164,18 +160,14 @@ var buildIndexSceneInterpolator = function(startStyles, endStyles) {
164160
min: 0,
165161
max: 1,
166162
},
167-
translateX: {
163+
left: {
168164
type: 'linear',
169-
from: 0,
170-
to: endStyles.Title.left - startStyles.Title.left,
165+
from: startStyles.Title.left,
166+
to: endStyles.Title.left,
171167
min: 0,
172168
max: 1,
173169
extrapolate: true,
174170
},
175-
left: {
176-
value: startStyles.Title.left,
177-
type: 'constant'
178-
},
179171
}),
180172
RightItem: buildStyleInterpolator({
181173
opacity: {

Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ function handleError(e, isFatal) {
4444
}
4545
}
4646

47+
/**
48+
* Assigns a new global property, replacing the existing one if there is one.
49+
*
50+
* Existing properties are preserved as `originalPropertyName`. Both properties
51+
* will maintain the same enumerability & configurability.
52+
*
53+
* This allows you to undo the more aggressive polyfills, should you need to.
54+
* For example, if you want to route network requests through DevTools (to trace
55+
* them):
56+
*
57+
* GLOBAL.XMLHTTPRequest = GLOBAL.originalXMLHTTPRequest;
58+
*
59+
* For more info on that particular case, see:
60+
* https://github.com/facebook/react-native/issues/934
61+
*/
62+
function polyfillGlobal(name, newValue, scope=GLOBAL) {
63+
var descriptor = Object.getOwnPropertyDescriptor(scope, name);
64+
65+
if (scope[name] !== undefined) {
66+
var backupName = `original${name[0].toUpperCase()}${name.substr(1)}`;
67+
Object.defineProperty(scope, backupName, {...descriptor, value: scope[name]});
68+
}
69+
Object.defineProperty(scope, name, {...descriptor, value: newValue});
70+
}
71+
4772
function setUpRedBoxErrorHandler() {
4873
var ErrorUtils = require('ErrorUtils');
4974
ErrorUtils.setGlobalHandler(handleError);
@@ -111,23 +136,23 @@ function setUpPromise() {
111136
function setUpXHR() {
112137
// The native XMLHttpRequest in Chrome dev tools is CORS aware and won't
113138
// let you fetch anything from the internet
114-
GLOBAL.XMLHttpRequest = require('XMLHttpRequest');
115-
GLOBAL.FormData = require('FormData');
139+
polyfillGlobal('XMLHttpRequest', require('XMLHttpRequest'));
140+
polyfillGlobal('FormData', require('FormData'));
116141

117142
var fetchPolyfill = require('fetch');
118-
GLOBAL.fetch = fetchPolyfill.fetch;
119-
GLOBAL.Headers = fetchPolyfill.Headers;
120-
GLOBAL.Request = fetchPolyfill.Request;
121-
GLOBAL.Response = fetchPolyfill.Response;
143+
polyfillGlobal('fetch', fetchPolyfill.fetch);
144+
polyfillGlobal('Headers', fetchPolyfill.Headers);
145+
polyfillGlobal('Request', fetchPolyfill.Request);
146+
polyfillGlobal('Response', fetchPolyfill.Response);
122147
}
123148

124149
function setUpGeolocation() {
125150
GLOBAL.navigator = GLOBAL.navigator || {};
126-
GLOBAL.navigator.geolocation = require('Geolocation');
151+
polyfillGlobal('geolocation', require('Geolocation'), GLOBAL.navigator);
127152
}
128153

129154
function setUpWebSockets() {
130-
GLOBAL.WebSocket = require('WebSocket');
155+
polyfillGlobal('WebSocket', require('WebSocket'));
131156
}
132157

133158
function setUpProfile() {

React.podspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Pod::Spec.new do |s|
2424
s.platform = :ios, "7.0"
2525
s.prepare_command = 'npm install --production'
2626
s.preserve_paths = "cli.js", "Libraries/**/*.js", "lint", "linter.js", "node_modules", "package.json", "packager", "PATENTS", "react-native-cli"
27-
s.header_mappings_dir = "."
2827

2928
s.subspec 'Core' do |ss|
3029
ss.source_files = "React/**/*.{c,h,m}"

ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ private static class SetSpanOperation {
7373
this.what = what;
7474
}
7575
public void execute(SpannableStringBuilder sb) {
76-
sb.setSpan(what, start, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
76+
// All spans will automatically extend to the right of the text, but not the left - except
77+
// for spans that start at the beginning of the text.
78+
int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE;
79+
if (start == 0) {
80+
spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
81+
}
82+
sb.setSpan(what, start, end, spanFlags);
7783
}
7884
}
7985

ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public class ReactTextInputManager extends
5656
public static final String PROP_TEXT_INPUT_TEXT = "text";
5757
@UIProp(UIProp.Type.NUMBER)
5858
public static final String PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT = "mostRecentEventCount";
59+
@UIProp(UIProp.Type.COLOR)
60+
public static final String PROP_TEXT_INPUT_COLOR = ViewProps.COLOR;
5961

6062
private static final String KEYBOARD_TYPE_EMAIL_ADDRESS = "email-address";
6163
private static final String KEYBOARD_TYPE_NUMERIC = "numeric";
@@ -157,16 +159,6 @@ public void setFontSize(ReactEditText view, float fontSize) {
157159
(int) Math.ceil(PixelUtil.toPixelFromSP(fontSize)));
158160
}
159161

160-
// Prevents flickering color while waiting for JS update.
161-
@ReactProp(name = ViewProps.COLOR, customType = "Color")
162-
public void setColor(ReactEditText view, @Nullable Integer color) {
163-
if (color == null) {
164-
view.setTextColor(DefaultStyleValuesUtil.getDefaultTextColor(view.getContext()));
165-
} else {
166-
view.setTextColor(color);
167-
}
168-
}
169-
170162
@ReactProp(name = "placeholder")
171163
public void setPlaceholder(ReactEditText view, @Nullable String placeholder) {
172164
view.setHint(placeholder);

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"type": "git",
88
"url": "[email protected]:facebook/react-native.git"
99
},
10+
"engines": {
11+
"node": ">=4"
12+
},
1013
"jest": {
1114
"scriptPreprocessor": "jestSupport/preprocessor.js",
1215
"setupEnvScriptFile": "jestSupport/env.js",

packager/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"type": "git",
77
"url": "[email protected]:facebook/react-native.git"
88
},
9+
"engines": {
10+
"node": ">=4"
11+
},
912
"jest": {
1013
"setupEnvScriptFile": "jestSupport/env.js",
1114
"testPathIgnorePatterns": [

website/server/extractDocs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ var apis = [
225225
'../Libraries/Storage/AsyncStorage.ios.js',
226226
'../Libraries/Utilities/BackAndroid.android.js',
227227
'../Libraries/CameraRoll/CameraRoll.js',
228+
'../Libraries/Utilities/Dimensions.js',
228229
'../Libraries/Interaction/InteractionManager.js',
229230
'../Libraries/LayoutAnimation/LayoutAnimation.js',
230231
'../Libraries/LinkingIOS/LinkingIOS.js',

0 commit comments

Comments
 (0)