mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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  After  Reviewed By: TheSavior, mmmulani Differential Revision: D17468880 Pulled By: JoshuaGross fbshipit-source-id: 838d3f512037b067ca96fcf5c9d98e2a18fc9821
This commit is contained in:
committed by
Facebook Github Bot
parent
b782934f3f
commit
d67c8d4dec
@@ -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>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user