Fix inspector for displaying styles' value

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 https://github.com/facebook/react-native/pull/5777

Reviewed By: svcscm

Differential Revision: D2908135

Pulled By: nicklockwood

fb-gh-sync-id: 5914f9e9538f90ae9a38ef7d8dc85b2df84ec43e
This commit is contained in:
wusuopu 2016-02-05 16:29:17 -08:00 committed by facebook-github-bot-3
parent 98797177ab
commit 97b8a57bdb
1 changed files with 5 additions and 1 deletions

View File

@ -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>
);