Skip to content

Commit

Permalink
Fix inspector for displaying styles' value
Browse files Browse the repository at this point in the history
Summary:
StyleInspector will occur a error if a style's value is an object, such as transform. Now it converts the value to string before display.

fix issue #5774 .

Now it can display okay.

![simulator screen shot feb 6 2016 12 32 24 am](https://cloud.githubusercontent.com/assets/1478284/12852296/36736966-cc69-11e5-8f28-9e4681585bcb.png)
Closes #5777

Reviewed By: svcscm

Differential Revision: D2908135

Pulled By: nicklockwood

fb-gh-sync-id: 5914f9e9538f90ae9a38ef7d8dc85b2df84ec43e
  • Loading branch information
wusuopu authored and facebook-github-bot-3 committed Feb 6, 2016
1 parent 9879717 commit 97b8a57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Libraries/Inspector/StyleInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ class StyleInspector extends React.Component {
<View>
{names.map(name => <Text style={styles.attr}>{name}:</Text>)}
</View>

<View>
{names.map(name => <Text style={styles.value}>{this.props.style[name]}</Text>)}
{names.map(name => {
var value = typeof this.props.style[name] === 'object' ? JSON.stringify(this.props.style[name]) : this.props.style[name];
return <Text style={styles.value}>{value}</Text>;
} ) }
</View>
</View>
);
Expand Down

0 comments on commit 97b8a57

Please sign in to comment.