UITableViewCell组合创建(React Native)

UITableViewCell组合创建(React Native)

by 伍雪颖


'use strict';
var React = require('react-native');
var {
  AppRegistry,StyleSheet,View,Image,Text,} = React;

class UIImageView extends React.Component {
  render() {
    return (
      <View style={styles.bgview}>
          <View style = {styles.cellBgView}>
          <Image
            source  = {{uri:'http://img.wdjimg.com/image/video/64d23dde9daac32367954b7c8a803da0_0_0.jpeg'}}
            style = {styles.image} />
          <View style = {styles.cellView}>
            <Text style={styles.title}>
             Xueyingwu
            </Text>
            <Text style = {styles.subtitle}>
            Work in China
            </Text>
            </View>
        </View>
        </View>
      );
  }
}

class SampleApp extends React.Component {
  render() {
    return (
      <React.NavigatorIOS
        style={styles.container}
        initialRoute={{
          title: 'My App',component: UIImageView,}}/>
    );
  }
}

var styles = React.StyleSheet.create({
  container: {
    flex: 1
  },bgview: {
    backgroundColor: '#eeeeee',paddingTop: 75,paddingLeft: 10,paddingRight: 10,paddingBottom: 10,},cellBgView:{flexDirection:'row',margin:40},image:{width:40,height:40,marginRight:10},cellView:{flex:1,justifyContent:'center',backgroundColor:'#ffffff'},title:{fontSize:11,fontWeight:'bold',subtitle:{fontSize:10},});

React.AppRegistry.registerComponent('SampleApp',function() { return SampleApp });

相关文章

一、前言 在组件方面react和Vue一样的,核心思想玩的就是组件...
前言: 前段时间学习完react后,刚好就接到公司一个react项目...
前言: 最近收到组长通知我们项目组后面新开的项目准备统一技...
react 中的高阶组件主要是对于 hooks 之前的类组件来说的,如...
我们上一节了解了组件的更新机制,但是只是停留在表层上,例...
我们上一节了解了 react 的虚拟 dom 的格式,如何把虚拟 dom...