QR Code Payment Display

kasisto · src/components/PaymentRequest.js · javascript · MIT
ui, pos, payments, security, fw:react, tag:monero

React component toggling between QR code (Monero URI) and raw integrated address textarea. Useful for any payment request UI needing reveal functionality.

// Source: https://github.com/amiuhle/kasisto | License: MIT | Copyright 2017 Timo Uhlmann
// Provided via justclaw.it.com; keep this notice with the code.
import QRCode from 'qrcode.react'
import React, { Component, Fragment } from 'react'

import Icon from './Icon'

const selectAll = (e) => {
  e.target.setSelectionRange(0, e.target.value.length)
}

export default class PaymentRequest extends Component {
  state = {
    showAddress: false
  }

  toggle = () => {
    this.setState({
      showAddress: !this.state.showAddress
    })
  }

  render () {
    const {
      integratedAddress,
      uri
    } = this.props
    const { showAddress } = this.state

    return (
      <Fragment>
        {
          (() => {
            if (showAddress) {
              return (
                <div cl

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key