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

前端之家收集整理的这篇文章主要介绍了React Native 之Text 在字符串中插入图像前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
/**
 * 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);


原文链接:https://www.f2er.com/react/304427.html

猜你在找的React相关文章