Skip to content

Commit

Permalink
Comment out warnValidStyle for fiber development
Browse files Browse the repository at this point in the history
This function looks at react-stack internals which to not work on
react-fiber.  Comment it out.
  • Loading branch information
fmoo committed Jul 10, 2017
1 parent c343912 commit e7e91f5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vendor/setValueForStyles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ if (process.env.NODE_ENV !== 'production') {
*/
var warnValidStyle = function(name, value, component) {
var owner;
/*
if (component) {
owner = component._currentElement._owner;
}
Expand All @@ -124,6 +125,7 @@ if (process.env.NODE_ENV !== 'production') {
if (typeof value === 'number' && isNaN(value)) {
warnStyleValueIsNaN(name, value, owner);
}
*/
};
}

Expand Down

2 comments on commit e7e91f5

@necolas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was originally copied from CSSPropertyOperations in react-dom so I could avoid reaching into react-dom/lib/*. Do you think it would be worth exposing that in react-dom's secret "don't fire" thing to avoid this kind of divergence from happening again as React DOM is developed?

@fmoo
Copy link
Owner Author

@fmoo fmoo commented on e7e91f5 Jul 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I think I need to dig into this a bit more.

The code in react-native looks largely identical. As far as I can tell, react-dom fiber bypasses this because when it calls CSSPropertyOperations.setValueForStyles(), it omits the third argument (component).

react-native-web's UIManager passes component._reactInternalInstance unconditionally.

Fiber does set _reactInternalInstance internally, is in src/renderers/shared/fiber/ReactFiberClassComponent.js, so I guess that's how react-native-web trips this but fiber dom does not.

Also of note, is that the Fiber components should have a dev-only attribute, _debugOwner. It may be possible to do something terrible like:

owner = component._debugOwner || (component._currentElement && component._currentElement._owner) || undefined

to try to handle fiber, but I haven't played with or tested this.

Please sign in to comment.