This repository was archived by the owner on Oct 20, 2022. It is now read-only.
  
  
  - 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 17
Icons
        _N_I_X_O_N_ edited this page Nov 4, 2019 
        ·
        11 revisions
      
    This Wiki show you how to use React Native Turbolinks integrated with React Native Vector Icons.
https://github.com/oblador/react-native-vector-icons#installation
import React, { Component } from 'react'
import Turbolinks from 'react-native-turbolinks'
import Icon from 'react-native-vector-icons/Ionicons'
export default class App extends Component {
  componentDidMount = async () => {
    await this.initializeIcons()
    Turbolinks.addEventListener('turbolinksVisit', this.handleVisit)
    Turbolinks.addEventListener('turbolinksError', this.handleError)
    Turbolinks.startSingleScreenApp({url: 'http://MYIP:9292', leftButtonIcon: this.cogIcon})
  }
  handleVisit = (data) => {
    Turbolinks.visit({url: data.url, action: data.action})
  }
  handleError = (data) => {
    alert(data.description)
  }
  initializeIcons = async () => {
    this.cogIcon     = await Icon.getImageSource('ios-cog', 20, 'blue')
    this.homeIcon    = await Icon.getImageSource('ios-home', 20, 'blue')
    this.infoIcon    = await Icon.getImageSource('ios-information-circle', 20, 'blue')
    this.refreshIcon = await Icon.getImageSource('ios-refresh', 20, 'blue')
    this.shareIcon   = await Icon.getImageSource('ios-share', 20, 'blue')
  }
  render() {
    return null
  }
}