From d67c8d4deca70a404c53b3f723efdabb443c943b Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Thu, 19 Sep 2019 13:42:23 -0700 Subject: [PATCH] Fix printing of false boolean values in the style inspector (#26431) Summary: React can't print false, we can just use `JSON.stringify` for any values except string to avoid adding quotes. ## Changelog [General] [Fixed] - Fix printing of false boolean values in the style inspector Pull Request resolved: https://github.com/facebook/react-native/pull/26431 Test Plan: Before ![image](https://user-images.githubusercontent.com/2677334/64896741-e4724d00-d64e-11e9-82b2-57275754523b.png) After ![image](https://user-images.githubusercontent.com/2677334/64896725-d8868b00-d64e-11e9-903b-8e5212456d78.png) Reviewed By: TheSavior, mmmulani Differential Revision: D17468880 Pulled By: JoshuaGross fbshipit-source-id: 838d3f512037b067ca96fcf5c9d98e2a18fc9821 --- Libraries/Inspector/StyleInspector.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Libraries/Inspector/StyleInspector.js b/Libraries/Inspector/StyleInspector.js index 64f001b116d..820224b3bc6 100644 --- a/Libraries/Inspector/StyleInspector.js +++ b/Libraries/Inspector/StyleInspector.js @@ -33,13 +33,12 @@ class StyleInspector extends React.Component<$FlowFixMeProps> { {names.map(name => { - const value = - typeof this.props.style[name] === 'object' - ? JSON.stringify(this.props.style[name]) - : this.props.style[name]; + const value = this.props.style[name]; return ( - {value} + {typeof value !== 'string' && typeof value !== 'number' + ? JSON.stringify(value) + : value} ); })}