美文网首页
React-Native:type props

React-Native:type props

作者: sy随缘 | 来源:发表于2018-09-11 10:06 被阅读0次

一、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>
)

相关文章

网友评论

      本文标题:React-Native:type props

      本文链接:https://www.haomeiwen.com/subject/bgmygftx.html