Basic React Native Part 12 - React Native Image

React Native Jan 02, 2020

Pada  Part 11 kita telah belajar dan mengenal TextInput jadi jika anda belum mengikuti tutorial Part 11 diharapkan anda mengikuti tutorial  Part 11 terlebih dahulu.

Pada Tutorial Part 12 ini kita mengenal terlebih dahulu Basic React Native Image. Image merupakan komponen untuk menampilkan berbagai jenis gambar baik itu gambar dari jaringan, gambar lokal sementara, dan gambar dari disk lokal, seperti kamera roll.

Untuk menampilkan Gambar pada React Native memiliki 4 cara yaitu :

  • Static Image Resources
  • Network Requests for Images
  • Uri Data Images
  • SVG Images

Mengimplementasikan Pada Project React Native

Buat Project React Native

Pada Tutorial Part 2 kita telah menginstall react-native-cli kemudian kita telah belajar cara membuat project baru react native. Berikut perintah cara untuk membuat project baru react native.

react-native init namafolderproject
Buat Project Baru

Install Aplikasi Debug Ke Handphone Android

Pada Tutorial Part 4 kita telah belajar cara menginstall Aplikasi Debug ke Handphone Android, untuk tata cara yang lebih jelas bisa langsung pelajari lagi pada Tutorial Part 4 terlebih dahulu. Secara singkat perintahnya seperti berikut.

react-native run-android
Install Aplikasi Debug Ke Handphone Android

Buka File App.js Dengan Visual Studio Code

Secara default pada file App.js memiliki code yang cukup dan menghasilkan tampilkan seperti berikut ini

import React from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  StatusBar,
} from 'react-native';

import {
  Header,
  LearnMoreLinks,
  Colors,
  DebugInstructions,
  ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

const App: () => React$Node = () => {
  return (
    <>
      <StatusBar barStyle="dark-content" />
      <SafeAreaView>
        <ScrollView
          contentInsetAdjustmentBehavior="automatic"
          style={styles.scrollView}>
          <Header />
          {global.HermesInternal == null ? null : (
            <View style={styles.engine}>
              <Text style={styles.footer}>Engine: Hermes</Text>
            </View>
          )}
          <View style={styles.body}>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>Step One</Text>
              <Text style={styles.sectionDescription}>
                Edit <Text style={styles.highlight}>App.js</Text> to change this
                screen and then come back to see your edits.
              </Text>
            </View>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>See Your Changes</Text>
              <Text style={styles.sectionDescription}>
                <ReloadInstructions />
              </Text>
            </View>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>Debug</Text>
              <Text style={styles.sectionDescription}>
                <DebugInstructions />
              </Text>
            </View>
            <View style={styles.sectionContainer}>
              <Text style={styles.sectionTitle}>Learn More</Text>
              <Text style={styles.sectionDescription}>
                Read the docs to discover what to do next:
              </Text>
            </View>
            <LearnMoreLinks />
          </View>
        </ScrollView>
      </SafeAreaView>
    </>
  );
};

const styles = StyleSheet.create({
  scrollView: {
    backgroundColor: Colors.lighter,
  },
  engine: {
    position: 'absolute',
    right: 0,
  },
  body: {
    backgroundColor: Colors.white,
  },
  sectionContainer: {
    marginTop: 32,
    paddingHorizontal: 24,
  },
  sectionTitle: {
    fontSize: 24,
    fontWeight: '600',
    color: Colors.black,
  },
  sectionDescription: {
    marginTop: 8,
    fontSize: 18,
    fontWeight: '400',
    color: Colors.dark,
  },
  highlight: {
    fontWeight: '700',
  },
  footer: {
    color: Colors.dark,
    fontSize: 12,
    fontWeight: '600',
    padding: 4,
    paddingRight: 12,
    textAlign: 'right',
  },
});

export default App;
Code Default App.js
Tampilan Default File App.js
Tampilan Default File App.js

Menghapus Code Default App.js

Untuk memudahkan memahami componen Image kita hapus semua code dafault App.js. Setelah semua code default App.js dihapus maka ikuti langkah - langkah berikut ini.

Static Image Resources

Metode ini kita harus menyimpan gambar ke dalam project kita, maka buat sebuah folder baru dengan nama src kemudian folder baru lagi didalam folder src  dengan nama image . Di dalam folder image inilah anda letakan gambar - gambar yang ingin anda masuk atau tampilkan dilayar aplikasi. Untuk cara pembuatan Folder saya anggap anda sudah bisa karena pada Tutorial Part sebelumnya karena kita sudah sering membuat Folder atau File baru.  

Folder dan File Gambar
  • Import React
import React, { Component } from 'react'
import react
  • Import Component Yang Dibutuhkan Untuk Project React Native
import {
View,
Image,
StyleSheet
}from 'react-native'
Import Component
  • Membuat Class Componet
class App extends Component {
  render() { 
    return (  );
  }
}
 
Membuat Class
  • Kemudian tambahan Component View , Image untuk menampilkan gambar car.png
class App extends React.Component {
  render() {
    return (
     // tambahkan Component View , Image
      <View style={styles.container}>
        <Image
          source={require('./src/image/car.png')}
          style={{ width: 400, height: 400 }}
        />
      </View>
    )
  }
}
Component View dan Image
  • Kemudian tambahkan code style setelah nya
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  },
})
Styling Image
  • Dan jangan lupa di export class
export default App
Export class App
  • Hasil Gambar Menggunakan Metode Static Image Resources
Static Image Resources

Network Requests for Images

Langkah - langkah sama saja seperti langkah - langkah diatas cukup menganti metode Panggil nya  Image saja.

 <Image
          source={{ uri: 'https://cloudborneo.com/content/images/2019/12/66-3.png' }}
          style={{ width: 100, height: 100 }}
        />
Network Requests for Images

Uri Data Images

      <Image
          style={{ width: 200, height: 158 }}
          source={{ uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAChCAMAAABkv1NnAAAAYFBMVEX///8L3P8L2/8A2f+8vLz4/v/5/v/y/f/r/P+r8P/j+v986P/n+//w/f/W+P/o+//M9v/F9f+g7v+58v/b+f945/9B4P/R9/+H6v9n5f9a4/+b7f/H9f+p8P8x3v+N6/8jnwWDAAAbg0lEQVR4nO0dh3LqujJeXQyYEkwx2ATz/3/5LK3KroplygnnzRxlklAkWVpvL/JXAUWhfguAy+brX5vW/vsqdFPw6/fzT6/o/6Q5wCHOif7w6SX9fzQFOJDopikWoDt/elH/D00CDpDDyR+Qv6KtPr2sv79xHlcYrLssPr2wv715PM69uM0+vbS/u2lSBU2q7geaf1JirHnqiP5BCdv+kxLpNgAOgEpVpw8XIE7/pESqcR7nN1Hc/9kS8SYxTjM1o9DZv/Iz0d/KT6/xr2yKVMeQDkRXf3qRf2PTpApUOFA+p8yw7vjpZf59LVSA6VswsD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/vBT+Dycb52OJjtHdZSU2JX+/AxkytqJEeDPGK0emyUiJz+pxf3cbrW+KnXSj1Y7Cx+sIaxgVZOby/MsRbOAzc+JK5qi4hUBqusjl02TNXydDsJHTvHJtvH8G1vjho5d8pD02d6530rn+35eprLdKJEnZLwquA3vylpW3grvx+r1RLMPsfvIe+Nd0xoINA5fAyiayHwClFLcIb8bCzmUB56Gvq9DBd/GcxD/I4/4cWr0288MUJmKZ67y03KER53ucPRTx//wTMxlHUY6U4WZ8cy1UcRL2WlwTsNTCLwh+zzgsHQuFS+B7zj7RN1j3SJt4L7Oz/UkW+Nw1wvomTwGOVDSngRjcxXdA9S9tAF5OYpzH+YBLIGSs20PwiWkvj87xzlmhSG5EFvz/EDPsv/8BK+onRhXuftAAAAAASUVORK5CYII=' }}
        />
Uri data Image
Uri data Image

SVG Images

Untuk gambar format svg kita tidak bisa menggunakan Component Image dari react nativenya kita harus menginstall Package Library Tambah dengan menjalankan perintah berikut melalui terminal linux dengan posisi berada di folder project react native yang akan diinstall library tersebut.

	
npm install react-native-remote-svg --save
Install Library

Kemudian setelah diinstall, sekarang Import Component Image menggunakan dari Library SVG dan tidak perlu menggunakan Component Image dari react native.


import {Image} from ‘react-native-remote-svg’
Import Component Image Dari Library SVG

Demikianlah pembahsan Tutorial Part 12 ini akan kita lanjutkan pada Tutorial Part 13

Wandi Pratama

Saya seorang Developer Mobile menggunakan Framework React Native dan saya juga memiliki pengalaman dibidang SYS Admin