Skip to content

Commit

Permalink
Partial React Sync for revisions 4eeee358e12c...2b18a13d2bf
Browse files Browse the repository at this point in the history
Summary:
This sync includes the following commits:

- **[2b18a13d2](facebook/react@2b18a13d2 )**: Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232) //<Eli White>//
- **[ab69a4d7e](facebook/react@ab69a4d7e )**: Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228) //<Eli White>//
- **[d26ed2e42](facebook/react@d26ed2e42 )**: Add findHostInstance_deprecated to the React Native Renderer (#17224) //<Eli White>//
- **[5ec25817c](facebook/react@5ec25817c )**: Dispatch commands to both UIManagers from both renderers (#17211) //<Eli White>//
- **[f68f5fcee](facebook/react@f68f5fcee )**: Update RN typings for a shim (#17138) //<Dan Abramov>//

Changelog:
[General][Changed] Partial React Sync for revisions 4eeee358e12c...2b18a13d2bf

Reviewed By: gaearon

Differential Revision: D18233299

fbshipit-source-id: 0adbc51d8a69de8b95f5efa4be011be88bc450aa
  • Loading branch information
TheSavior authored and facebook-github-bot committed Oct 31, 2019
1 parent 4b487ba commit bb29cd9
Show file tree
Hide file tree
Showing 13 changed files with 322 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Libraries/Renderer/implementations/ReactFabric-dev.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -24475,6 +24475,59 @@ var _nativeFabricUIManage = nativeFabricUIManager;
var fabricDispatchCommand = _nativeFabricUIManage.dispatchCommand;
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

function findHostInstance_DEPRECATED(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;

if (owner !== null && owner.stateNode !== null) {
!owner.stateNode._warnedAboutRefsInRender
? warningWithoutStack$1(
false,
"%s is accessing findNodeHandle inside its render(). " +
"render() should be a pure function of props and state. It should " +
"never access something that requires stale data from the previous " +
"render, such as refs. Move this logic to componentDidMount and " +
"componentDidUpdate instead.",
getComponentName(owner.type) || "A component"
)
: void 0;
owner.stateNode._warnedAboutRefsInRender = true;
}
}

if (componentOrHandle == null) {
return null;
}

if (componentOrHandle._nativeTag) {
return componentOrHandle;
}

if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) {
return componentOrHandle.canonical;
}

var hostInstance;

{
hostInstance = findHostInstanceWithWarning(
componentOrHandle,
"findHostInstance_DEPRECATED"
);
}

if (hostInstance == null) {
return hostInstance;
}

if (hostInstance.canonical) {
// Fabric
return hostInstance.canonical;
}

return hostInstance;
}

function findNodeHandle(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;
Expand Down Expand Up @@ -24543,6 +24596,9 @@ setBatchingImplementation(
var roots = new Map();
var ReactFabric = {
NativeComponent: ReactNativeComponent$1(findNodeHandle, findHostInstance),
// This is needed for implementation details of TouchableNativeFeedback
// Remove this once TouchableNativeFeedback doesn't use cloneElement
findHostInstance_DEPRECATED: findHostInstance_DEPRECATED,
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
var invalid =
Expand Down
56 changes: 56 additions & 0 deletions Libraries/Renderer/implementations/ReactFabric-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -24472,6 +24472,59 @@ var _nativeFabricUIManage = nativeFabricUIManager;
var fabricDispatchCommand = _nativeFabricUIManage.dispatchCommand;
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

function findHostInstance_DEPRECATED(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;

if (owner !== null && owner.stateNode !== null) {
!owner.stateNode._warnedAboutRefsInRender
? warningWithoutStack$1(
false,
"%s is accessing findNodeHandle inside its render(). " +
"render() should be a pure function of props and state. It should " +
"never access something that requires stale data from the previous " +
"render, such as refs. Move this logic to componentDidMount and " +
"componentDidUpdate instead.",
getComponentName(owner.type) || "A component"
)
: void 0;
owner.stateNode._warnedAboutRefsInRender = true;
}
}

if (componentOrHandle == null) {
return null;
}

if (componentOrHandle._nativeTag) {
return componentOrHandle;
}

if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) {
return componentOrHandle.canonical;
}

var hostInstance;

{
hostInstance = findHostInstanceWithWarning(
componentOrHandle,
"findHostInstance_DEPRECATED"
);
}

if (hostInstance == null) {
return hostInstance;
}

if (hostInstance.canonical) {
// Fabric
return hostInstance.canonical;
}

return hostInstance;
}

function findNodeHandle(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;
Expand Down Expand Up @@ -24540,6 +24593,9 @@ setBatchingImplementation(
var roots = new Map();
var ReactFabric = {
NativeComponent: ReactNativeComponent$1(findNodeHandle, findHostInstance),
// This is needed for implementation details of TouchableNativeFeedback
// Remove this once TouchableNativeFeedback doesn't use cloneElement
findHostInstance_DEPRECATED: findHostInstance_DEPRECATED,
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
var invalid =
Expand Down
12 changes: 12 additions & 0 deletions Libraries/Renderer/implementations/ReactFabric-prod.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7567,6 +7567,18 @@ var roots = new Map(),
return ReactNativeComponent;
})(React.Component);
})(findNodeHandle, findHostInstance),
findHostInstance_DEPRECATED: function(componentOrHandle) {
if (null == componentOrHandle) return null;
if (componentOrHandle._nativeTag) return componentOrHandle;
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
return componentOrHandle.canonical;
componentOrHandle = findHostInstance(componentOrHandle);
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
null != handle._nativeTag &&
Expand Down
12 changes: 12 additions & 0 deletions Libraries/Renderer/implementations/ReactFabric-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7567,6 +7567,18 @@ var roots = new Map(),
return ReactNativeComponent;
})(React.Component);
})(findNodeHandle, findHostInstance),
findHostInstance_DEPRECATED: function(componentOrHandle) {
if (null == componentOrHandle) return null;
if (componentOrHandle._nativeTag) return componentOrHandle;
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
return componentOrHandle.canonical;
componentOrHandle = findHostInstance(componentOrHandle);
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
null != handle._nativeTag &&
Expand Down
12 changes: 12 additions & 0 deletions Libraries/Renderer/implementations/ReactFabric-profiling.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7833,6 +7833,18 @@ var roots = new Map(),
return ReactNativeComponent;
})(React.Component);
})(findNodeHandle, findHostInstance),
findHostInstance_DEPRECATED: function(componentOrHandle) {
if (null == componentOrHandle) return null;
if (componentOrHandle._nativeTag) return componentOrHandle;
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
return componentOrHandle.canonical;
componentOrHandle = findHostInstance(componentOrHandle);
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
null != handle._nativeTag &&
Expand Down
12 changes: 12 additions & 0 deletions Libraries/Renderer/implementations/ReactFabric-profiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -7833,6 +7833,18 @@ var roots = new Map(),
return ReactNativeComponent;
})(React.Component);
})(findNodeHandle, findHostInstance),
findHostInstance_DEPRECATED: function(componentOrHandle) {
if (null == componentOrHandle) return null;
if (componentOrHandle._nativeTag) return componentOrHandle;
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
return componentOrHandle.canonical;
componentOrHandle = findHostInstance(componentOrHandle);
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
null != handle._nativeTag &&
Expand Down
56 changes: 56 additions & 0 deletions Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -24223,6 +24223,59 @@ var getInspectorDataForViewTag;

var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

function findHostInstance_DEPRECATED(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;

if (owner !== null && owner.stateNode !== null) {
!owner.stateNode._warnedAboutRefsInRender
? warningWithoutStack$1(
false,
"%s is accessing findNodeHandle inside its render(). " +
"render() should be a pure function of props and state. It should " +
"never access something that requires stale data from the previous " +
"render, such as refs. Move this logic to componentDidMount and " +
"componentDidUpdate instead.",
getComponentName(owner.type) || "A component"
)
: void 0;
owner.stateNode._warnedAboutRefsInRender = true;
}
}

if (componentOrHandle == null) {
return null;
}

if (componentOrHandle._nativeTag) {
return componentOrHandle;
}

if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) {
return componentOrHandle.canonical;
}

var hostInstance;

{
hostInstance = findHostInstanceWithWarning(
componentOrHandle,
"findHostInstance_DEPRECATED"
);
}

if (hostInstance == null) {
return hostInstance;
}

if (hostInstance.canonical) {
// Fabric
return hostInstance.canonical;
}

return hostInstance;
}

function findNodeHandle(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;
Expand Down Expand Up @@ -24301,6 +24354,9 @@ function computeComponentStackForErrorReporting(reactTag) {
var roots = new Map();
var ReactNativeRenderer = {
NativeComponent: ReactNativeComponent(findNodeHandle, findHostInstance),
// This is needed for implementation details of TouchableNativeFeedback
// Remove this once TouchableNativeFeedback doesn't use cloneElement
findHostInstance_DEPRECATED: findHostInstance_DEPRECATED,
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
if (handle._nativeTag == null) {
Expand Down
56 changes: 56 additions & 0 deletions Libraries/Renderer/implementations/ReactNativeRenderer-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -24220,6 +24220,59 @@ var getInspectorDataForViewTag;

var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

function findHostInstance_DEPRECATED(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;

if (owner !== null && owner.stateNode !== null) {
!owner.stateNode._warnedAboutRefsInRender
? warningWithoutStack$1(
false,
"%s is accessing findNodeHandle inside its render(). " +
"render() should be a pure function of props and state. It should " +
"never access something that requires stale data from the previous " +
"render, such as refs. Move this logic to componentDidMount and " +
"componentDidUpdate instead.",
getComponentName(owner.type) || "A component"
)
: void 0;
owner.stateNode._warnedAboutRefsInRender = true;
}
}

if (componentOrHandle == null) {
return null;
}

if (componentOrHandle._nativeTag) {
return componentOrHandle;
}

if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) {
return componentOrHandle.canonical;
}

var hostInstance;

{
hostInstance = findHostInstanceWithWarning(
componentOrHandle,
"findHostInstance_DEPRECATED"
);
}

if (hostInstance == null) {
return hostInstance;
}

if (hostInstance.canonical) {
// Fabric
return hostInstance.canonical;
}

return hostInstance;
}

function findNodeHandle(componentOrHandle) {
{
var owner = ReactCurrentOwner.current;
Expand Down Expand Up @@ -24298,6 +24351,9 @@ function computeComponentStackForErrorReporting(reactTag) {
var roots = new Map();
var ReactNativeRenderer = {
NativeComponent: ReactNativeComponent(findNodeHandle, findHostInstance),
// This is needed for implementation details of TouchableNativeFeedback
// Remove this once TouchableNativeFeedback doesn't use cloneElement
findHostInstance_DEPRECATED: findHostInstance_DEPRECATED,
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
if (handle._nativeTag == null) {
Expand Down
12 changes: 12 additions & 0 deletions Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7782,6 +7782,18 @@ var roots = new Map(),
return ReactNativeComponent;
})(React.Component);
})(findNodeHandle, findHostInstance),
findHostInstance_DEPRECATED: function(componentOrHandle) {
if (null == componentOrHandle) return null;
if (componentOrHandle._nativeTag) return componentOrHandle;
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
return componentOrHandle.canonical;
componentOrHandle = findHostInstance(componentOrHandle);
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
null != handle._nativeTag &&
Expand Down
12 changes: 12 additions & 0 deletions Libraries/Renderer/implementations/ReactNativeRenderer-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7782,6 +7782,18 @@ var roots = new Map(),
return ReactNativeComponent;
})(React.Component);
})(findNodeHandle, findHostInstance),
findHostInstance_DEPRECATED: function(componentOrHandle) {
if (null == componentOrHandle) return null;
if (componentOrHandle._nativeTag) return componentOrHandle;
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
return componentOrHandle.canonical;
componentOrHandle = findHostInstance(componentOrHandle);
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
null != handle._nativeTag &&
Expand Down
Loading

0 comments on commit bb29cd9

Please sign in to comment.