牛骨文教育服务平台(让学习变的简单)
博文笔记

React Native 之Text 在字符串中插入图像

创建时间:2017-03-30 投稿人: 浏览次数:1802
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from "react";
import {
  AppRegistry,
  StyleSheet,
  Image,
  Text,
  TouchableHighlight,
  View
} from "react-native";


export default class ViewProject extends Component {

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          welcome to <Image source={require("./img/icon.png")} style={styles.imageInTextStyle}/>
          React Native
        </Text>
      </View>
    );
  }


}



const styles = StyleSheet.create({
  container: {
    flex:1,
    justifyContent: "center",
    alignItems:"center"
  },
  welcome:{
   fontSize:40,
   textAlign:"center",
   margin:5
  },
  imageInTextStyle:{
    width:100,
    height:100,
    resizeMode:"cover"
  }


});
AppRegistry.registerComponent("ViewProject", () => ViewProject);



声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。