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
This commit is contained in:
Janic Duplessis
2019-09-19 13:44:25 -07:00
committed by Facebook Github Bot
parent b782934f3f
commit d67c8d4dec
+4 -5
View File
@@ -33,13 +33,12 @@ class StyleInspector extends React.Component<$FlowFixMeProps> {
<View>
{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 (
<Text key={name} style={styles.value}>
{value}
{typeof value !== 'string' && typeof value !== 'number'
? JSON.stringify(value)
: value}
</Text>
);
})}