一、TypeScript入门
https://www.jianshu.com/p/c4e639296b98
type ItemProps = {
title: String,
desc: String,
backgroundColor: String,
borderColor: String,
img: any,
onPress: Function,
}
const Item = ({ backgroundColor, borderColor, img, title, desc, onPress }:ItemProps) => (
<TouchableOpacity onPress={() => onPress()} style={rowStyles.itemContainer}>
<View style={{ flex: 1, backgroundColor, borderColor, borderWidth, borderRadius: 6, flexDirection: 'row', justifyContent: 'space-between' }}>
<View style={{ justifyContent: 'center', marginLeft: itemMarginLeft }}>
<Text style={rowStyles.itemTitleText}>{title}</Text>
<Text style={rowStyles.itemDescText}>{desc}</Text>
</View>
<Image source={img} style={rowStyles.rightImg} />
</View>
</TouchableOpacity>
)
网友评论