0.0.14 • Published 6 years ago
react-gigagenie v0.0.14
react-gigagenie
A KT GiGA Genie Component for React
Install
yarn add react-gigagenie
How to use
There're some steps to take to create your custom map components.
1. In order to initialize the MyComponent
with the credential, you'll need to wrap it with withCredential
HOC.
1. In order to correctly load gigagenie
JavaScript client library, you'll need to wrap it with withScriptjs
.
1. Notice there're some required props for withCredential and withScriptjs HOC.
import { withScriptjs, withCredential } from "react-gigagenie"
const MyComponent = withScriptjs(withCredential((props) =>
<span>
{props.displayName}
</span>
))
<MyComponent
apikey='YOUR_API_KEY'
keytype='GBOXDEVM'
/>
Example
import GigaGenie from 'react-gigagenie';
import React, {Component} from 'react';
class VoiceTest extends Component {
constructor(props) {
Voice.onActionEvent = this.onActionEventHandler.bind(this);
}
onStartButtonPress(e){
GigaGenie.getVoiceText('en-US');
}
...
}
All methods now return a new Promise
for async/await
compatibility.
Method Name | Description |
---|---|
GigaGenie.getVoiceText(text, locale) | Starts listening for speech for a specific locale. Returns null if no error occurs. |
GigaGenie.stopTTS() | Cancels the speech recognition. Returns null if no error occurs. |
Event Name | Description | Event | Platform |
---|---|---|---|
Voice.onActionEvent(event) | Invoked when SpeechRecognizer stops recognition. | { error: false } | Android, iOS |