New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-voice-input

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-voice-input

react voice input

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

react-voice-input

Voice input component for React.JS

Installation

$ npm install react-voice-input

Usage

import ReactVoiceInput from 'react-voice-input'
import React from 'react'

class MyApp extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      inputText: ''
    }

    this.onResult = this.onResult.bind(this)
    this.onInputChange = this.onInputChange.bind(this)
  }

  onInputChange (event) {
    this.setState({
      inputText: event.target.value
    })
  }

  onResult (result) {
    this.setState({
      inputText: result
    })
  }

  render () {
    const onEnd = () => {
      console.log('on end')
    }
    return (
      <main>
        <ReactVoiceInput
          onResult={this.onResult}
          onEnd={onEnd}
        >
          <input type='text' value={inputText} onChange={this.onInputChange} />
        </ReactVoiceInput>
      </main>
    )
  }
}

API

  • onSpeechStart() - optional callback function to detect speech start
  • onResult(value) - callback function when get value from speech
  • onEnd() - optional callback function when the speech end
  • onError(event) - optional callback function when there's an error
  • containerClassName - optional, the class name apply to the container, default to rvi-contianer
  • microphoneClassName - optional, the class name apply to microphone, default to rvi-microphone
  • microphoneStyle - optional inline style for the button

For how to use it, check the example folder.

Run example

$ cd example
$ yarn
$ yarn run dev

Then go to http://localhost:3000/ in browser.

License

MIT

FAQs

Package last updated on 11 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts