Get rid of transformMatrix/decomposeMatrix special case (#6660)
This is no longer needed on the native side. This is also the last use of the Platform flag. React Core is now platform agnostic with regard to React Native. So I'll remove the mocks and dependency.
Sebastian Markbåge committed
Apr 29, 2016 at 15:57 UTC
0e4b04663422d217f5a796936435603037b08bb5
4 files changed
+7
-71
gulpfile.js
-3
@@ -39,10 +39,7 @@ var whiteListNames = [
39
'deepFreezeAndThrowOnMutationInDev',
40
'flattenStyle',
41
'InitializeJavaScriptAppEngine',
42
- 'InteractionManager',
42
'JSTimersExecution',
44
- 'merge',
45
- 'Platform',
43
'RCTEventEmitter',
44
'RCTLog',
45
'TextInputState',
src/renderers/native/ReactNative/ReactNativeAttributePayload.js
+7
-36
@@ -11,7 +11,6 @@
11
*/
12
'use strict';
13
14
-var Platform = require('Platform');
14
var ReactNativePropRegistry = require('ReactNativePropRegistry');
15
16
var deepDiffer = require('deepDiffer');
@@ -47,21 +46,6 @@ type NestedNode = Array<NestedNode> | Object | number;
46
var removedKeys = null;
47
var removedKeyCount = 0;
48
50
-function translateKey(propKey: string) : string {
51
- if (propKey === 'transform') {
52
- // We currently special case the key for `transform`. iOS uses the
53
- // transformMatrix name and Android uses the decomposedMatrix name.
54
- // TODO: We could unify these names and just use the name `transform`
55
- // all the time. Just need to update the native side.
56
- if (Platform.OS === 'android') {
57
- return 'decomposedMatrix';
58
- } else {
59
- return 'transformMatrix';
60
- }
61
- }
62
- return propKey;
63
-}
64
-
49
function defaultDiffer(prevProp: mixed, nextProp: mixed) : boolean {
50
if (typeof nextProp !== 'object' || nextProp === null) {
51
// Scalars have already been checked for equality
@@ -326,7 +310,6 @@ function diffProperties(
310
var attributeConfig : ?(CustomAttributeConfiguration | AttributeConfiguration);
311
var nextProp;
312
var prevProp;
329
- var altKey;
313
314
for (var propKey in nextProps) {
315
attributeConfig = validAttributes[propKey];
@@ -334,12 +317,6 @@ function diffProperties(
317
continue; // not a valid native prop
318
}
319
337
- altKey = translateKey(propKey);
338
- if (!validAttributes[altKey]) {
339
- // If there is no config for the alternative, bail out. Helps ART.
340
- altKey = propKey;
341
- }
342
-
320
prevProp = prevProps[propKey];
321
nextProp = nextProps[propKey];
322
@@ -367,7 +344,7 @@ function diffProperties(
344
removedKeys[propKey] = false;
345
}
346
370
- if (updatePayload && updatePayload[altKey] !== undefined) {
347
+ if (updatePayload && updatePayload[propKey] !== undefined) {
348
// Something else already triggered an update to this key because another
349
// value diffed. Since we're now later in the nested arrays our value is
350
// more important so we need to calculate it and override the existing
@@ -376,14 +353,14 @@ function diffProperties(
353
// Pattern match on: attributeConfig
354
if (typeof attributeConfig !== 'object') {
355
// case: !Object is the default case
379
- updatePayload[altKey] = nextProp;
356
+ updatePayload[propKey] = nextProp;
357
} else if (typeof attributeConfig.diff === 'function' ||
358
typeof attributeConfig.process === 'function') {
359
// case: CustomAttributeConfiguration
360
var nextValue = typeof attributeConfig.process === 'function' ?
361
attributeConfig.process(nextProp) :
362
nextProp;
386
- updatePayload[altKey] = nextValue;
363
+ updatePayload[propKey] = nextValue;
364
}
365
continue;
366
}
@@ -397,7 +374,7 @@ function diffProperties(
374
// case: !Object is the default case
375
if (defaultDiffer(prevProp, nextProp)) {
376
// a normal leaf has changed
400
- (updatePayload || (updatePayload = {}))[altKey] = nextProp;
377
+ (updatePayload || (updatePayload = {}))[propKey] = nextProp;
378
}
379
} else if (typeof attributeConfig.diff === 'function' ||
380
typeof attributeConfig.process === 'function') {
@@ -411,7 +388,7 @@ function diffProperties(
388
nextValue = typeof attributeConfig.process === 'function' ?
389
attributeConfig.process(nextProp) :
390
nextProp;
414
- (updatePayload || (updatePayload = {}))[altKey] = nextValue;
391
+ (updatePayload || (updatePayload = {}))[propKey] = nextValue;
392
}
393
} else {
394
// default: fallthrough case when nested properties are defined
@@ -446,13 +423,7 @@ function diffProperties(
423
continue; // not a valid native prop
424
}
425
449
- altKey = translateKey(propKey);
450
- if (!attributeConfig[altKey]) {
451
- // If there is no config for the alternative, bail out. Helps ART.
452
- altKey = propKey;
453
- }
454
-
455
- if (updatePayload && updatePayload[altKey] !== undefined) {
426
+ if (updatePayload && updatePayload[propKey] !== undefined) {
427
// This was already updated to a diff result earlier.
428
continue;
429
}
@@ -468,7 +439,7 @@ function diffProperties(
439
440
// case: CustomAttributeConfiguration | !Object
441
// Flag the leaf property for removal by sending a sentinel.
471
- (updatePayload || (updatePayload = {}))[altKey] = null;
442
+ (updatePayload || (updatePayload = {}))[propKey] = null;
443
if (!removedKeys) {
444
removedKeys = {};
445
}
src/renderers/native/ReactNative/__mocks__/InteractionManager.js
deleted
-16
@@ -1,16 +0,0 @@
1
-/**
2
- * Copyright 2013-2015, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- */
9
-
10
-'use strict';
11
-
12
-// TODO: Figure out a way to drop this dependency
13
-
14
-var InteractionManager = {};
15
-
16
-module.exports = InteractionManager;
src/renderers/native/ReactNative/__mocks__/Platform.js
deleted
-16
@@ -1,16 +0,0 @@
1
-/**
2
- * Copyright 2013-2015, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- */
9
-
10
-'use strict';
11
-
12
-// Mock of the Native Hooks
13
-
14
-var Platform = {};
15
-
16
-module.exports = Platform;