React native 吐槽贴

2015-04-01 08:52:23 +08:00
 gavinkwoe

总是觉得这种Wiring up的代码是evil的,有没有同感?

var MovieScreen = React.createClass({
render: function() {
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<View style={styles.mainSection}>
<Image
source={getImageSource(this.props.movie, 'det')}
style={styles.detailsImage}
/>
<View style={styles.rightPane}>
<Text style={styles.movieTitle}>{this.props.movie.title}</Text>
<Text>{this.props.movie.year}</Text>
<View style={styles.mpaaWrapper}>
<Text style={styles.mpaaText}>
{this.props.movie.mpaa_rating}
</Text>
</View>
<Ratings ratings={this.props.movie.ratings} />
</View>
</View>
<View style={styles.separator} />
<Text>
{this.props.movie.synopsis}
</Text>
<View style={styles.separator} />
<Cast actors={this.props.movie.abridged_cast} />
</ScrollView>
);
},
});

2960 次点击
所在节点    问与答
6 条回复
babyname
2015-04-01 08:55:43 +08:00
很丑 不过简单啊
yakczh
2015-04-01 09:20:09 +08:00
这才叫view
icyflash
2015-04-01 09:36:35 +08:00
XAML 既视感
otakustay
2015-04-01 11:10:31 +08:00
写在哪里不是写,上面再封装一层很容易做分离的
Daizong
2015-04-01 11:35:02 +08:00
分离和混合各有利弊,适应就好
tokki
2015-04-01 11:41:33 +08:00
他们 有两个视频啊 你看一下就明白他们的想法啦

http://facebook.github.io/react-native/docs/videos.html#content

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/180738

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX