Skip to content

Latest commit

 

History

History
175 lines (144 loc) · 4.01 KB

buttonNearDone.md

File metadata and controls

175 lines (144 loc) · 4.01 KB

Button near done

Introduction

This plugin allows for a creation of a custom button near the "done" button. In order for this button to work the following conditions must be met:

  • The button image MUST be an SVG
  • The ToolBarType must be set to default

Showcase

This button will look in the following way:

Android

Alt text

IOS

Alt text

Config options:

buttonNearDone
ios android
name type decryption
iconType 'sf-symbol' | 'asset' If set to sf-symbol, it's going to use the sf-symbol library
Otherwise, it's going to use a file from Assets.xcassets
icon String The path/name of the icon to use
name type description
iconType 'asset' It MUST always be equal to asset!
It's going to read the main assets of your app
icon String The path of the icon to use
width number? An optional number describing the width of the button.
Defaults to 48
height number? An optional number describing the height of the button.
Defaults to 48

asset iconType on IOS

First, please open your app in xcode. Then, please add an svg file into Assets.xcassets like so:

Alt text

Legend:

  1. The file where you need to add your icon to
  2. Your icon
  3. The 1x size. The plugin will always use the 1x size

Later, you would use it as:

InAppBrowser.openWebView({ 
  url: WEB_URL, 
  buttonNearDone: { 
    ios: { icon: 'monkey', iconType: 'asset' },
  } 
})

asset iconType on Android

First, please open your app in vscode. Then, please add an svg file into public/your_file.svg like so:

Alt text

Legend:

  1. The folder where you need the file into
  2. Your icon

Later, you would use it as:

InAppBrowser.openWebView({ 
  url: WEB_URL,
  buttonNearDone: { 
    android: { icon: 'public/monkey.svg', iconType: 'asset' }
  } 
})

Configuration for both platforms

If you use both platforms, you would use the following config:

InAppBrowser.openWebView({ 
  url: WEB_URL,
  buttonNearDone: { 
    ios: { icon: 'monkey', iconType: 'resource' },
    android: { icon: 'public/monkey.svg', iconType: 'asset' }
  } 
})

Listening for buttonNearDoneClick events

InAppBrowser.addListener('buttonNearDoneClick', async (msg) => {
  // Write your code here
  await InAppBrowser.setUrl({ url: 'https://web.capgo.app/login' })
})