Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RN] Remove ReactNativePropRegistry #12559

Merged
merged 1 commit into from
Apr 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/react-native-renderer/src/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import ReactNativeBridgeEventPlugin from './ReactNativeBridgeEventPlugin';
import ReactNativeComponent from './ReactNativeComponent';
import * as ReactNativeComponentTree from './ReactNativeComponentTree';
import ReactFabricRenderer from './ReactFabricRenderer';
import ReactNativePropRegistry from './ReactNativePropRegistry';
import {getInspectorDataForViewTag} from './ReactNativeFiberInspector';
import createReactNativeComponentClass from './createReactNativeComponentClass';
import {injectFindHostInstanceFabric} from './findNodeHandle';
Expand Down Expand Up @@ -85,7 +84,6 @@ const ReactFabric: ReactNativeType = {
// Used by react-native-github/Libraries/ components
ReactNativeBridgeEventPlugin, // requireNativeComponent
ReactNativeComponentTree, // ScrollResponder
ReactNativePropRegistry, // flattenStyle, Stylesheet
createReactNativeComponentClass, // RCTText, RCTView, ReactNativeART
takeSnapshot, // react-native-implementation
},
Expand Down
36 changes: 7 additions & 29 deletions packages/react-native-renderer/src/ReactNativeAttributePayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import deepDiffer from 'deepDiffer';
import flattenStyle from 'flattenStyle';

import ReactNativePropRegistry from './ReactNativePropRegistry';

const emptyObject = {};

/**
Expand All @@ -38,7 +36,7 @@ type AttributeConfiguration = {
| AttributeConfiguration /*| boolean*/,
};

type NestedNode = Array<NestedNode> | Object | number;
type NestedNode = Array<NestedNode> | Object;

// Tracks removed keys
let removedKeys = null;
Expand All @@ -54,13 +52,6 @@ function defaultDiffer(prevProp: mixed, nextProp: mixed): boolean {
}
}

function resolveObject(idOrObject: number | Object): Object {
if (typeof idOrObject === 'number') {
return ReactNativePropRegistry.getByID(idOrObject);
}
return idOrObject;
}

function restoreDeletedValuesInNestedArray(
updatePayload: Object,
node: NestedNode,
Expand All @@ -76,7 +67,7 @@ function restoreDeletedValuesInNestedArray(
);
}
} else if (node && removedKeyCount > 0) {
const obj = resolveObject(node);
const obj = node;
for (const propKey in removedKeys) {
if (!removedKeys[propKey]) {
continue;
Expand Down Expand Up @@ -180,12 +171,7 @@ function diffNestedProperty(

if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) {
// Both are leaves, we can diff the leaves.
return diffProperties(
updatePayload,
resolveObject(prevProp),
resolveObject(nextProp),
validAttributes,
);
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
}

if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
Expand All @@ -204,14 +190,14 @@ function diffNestedProperty(
// $FlowFixMe - We know that this is always an object when the input is.
flattenStyle(prevProp),
// $FlowFixMe - We know that this isn't an array because of above flow.
resolveObject(nextProp),
nextProp,
validAttributes,
);
}

return diffProperties(
updatePayload,
resolveObject(prevProp),
prevProp,
// $FlowFixMe - We know that this is always an object when the input is.
flattenStyle(nextProp),
validAttributes,
Expand All @@ -234,11 +220,7 @@ function addNestedProperty(

if (!Array.isArray(nextProp)) {
// Add each property of the leaf.
return addProperties(
updatePayload,
resolveObject(nextProp),
validAttributes,
);
return addProperties(updatePayload, nextProp, validAttributes);
}

for (let i = 0; i < nextProp.length; i++) {
Expand Down Expand Up @@ -268,11 +250,7 @@ function clearNestedProperty(

if (!Array.isArray(prevProp)) {
// Add each property of the leaf.
return clearProperties(
updatePayload,
resolveObject(prevProp),
validAttributes,
);
return clearProperties(updatePayload, prevProp, validAttributes);
}

for (let i = 0; i < prevProp.length; i++) {
Expand Down
40 changes: 0 additions & 40 deletions packages/react-native-renderer/src/ReactNativePropRegistry.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/react-native-renderer/src/ReactNativeRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import ReactNativeBridgeEventPlugin from './ReactNativeBridgeEventPlugin';
import ReactNativeComponent from './ReactNativeComponent';
import * as ReactNativeComponentTree from './ReactNativeComponentTree';
import ReactNativeFiberRenderer from './ReactNativeFiberRenderer';
import ReactNativePropRegistry from './ReactNativePropRegistry';
import {getInspectorDataForViewTag} from './ReactNativeFiberInspector';
import createReactNativeComponentClass from './createReactNativeComponentClass';
import {injectFindHostInstance} from './findNodeHandle';
Expand Down Expand Up @@ -104,7 +103,6 @@ const ReactNativeRenderer: ReactNativeType = {
// Used by react-native-github/Libraries/ components
ReactNativeBridgeEventPlugin, // requireNativeComponent
ReactNativeComponentTree, // ScrollResponder
ReactNativePropRegistry, // flattenStyle, Stylesheet
createReactNativeComponentClass, // RCTText, RCTView, ReactNativeART
takeSnapshot, // react-native-implementation
computeComponentStackForErrorReporting,
Expand Down
1 change: 0 additions & 1 deletion packages/react-native-renderer/src/ReactNativeTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ type SecretInternalsType = {
): any,
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin,
ReactNativeComponentTree: any,
ReactNativePropRegistry: any,
// TODO (bvaughn) Decide which additional types to expose here?
// And how much information to fill in for the above types.
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
'use strict';

const ReactNativeAttributePayload = require('../ReactNativeAttributePayload');
const ReactNativePropRegistry = require('../ReactNativePropRegistry').default;

const diff = ReactNativeAttributePayload.diff;

Expand Down Expand Up @@ -114,9 +113,9 @@ describe('ReactNativeAttributePayload', () => {
diff({someStyle: [{foo: 1}, {bar: 2}]}, {}, validStyleAttribute),
).toEqual({foo: null, bar: null});

const barStyle = ReactNativePropRegistry.register({
const barStyle = {
bar: 3,
});
};

expect(
diff(
Expand Down
18 changes: 0 additions & 18 deletions scripts/rollup/shims/react-native/ReactNativePropRegistry.js

This file was deleted.