Learn the Basics - RN2

使用Imagereact

1. 引用git

import { Image } from 'react-native';

2. 使用github

    format:react-native

    <Image source={{}} style{{}} />app

例如:flex

<Image source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'}}
            style={{width: 193, height: 110}}/>

 

源代碼:spa

App.jscode

import React from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Image source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'}}
            style={{width: 193, height: 110}}/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

 

Reference:orm

1. Learn the Basics - v0.59blog

相關文章
相關標籤/搜索