README
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.
- In order to initialize the
MyComponent
with the credential, you'll need to wrap it with [withCredential
] HOC. - In order to correctly load
gigagenie
JavaScript client library, you'll need to wrap it with [withScriptjs
]. - 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'
/>
Usage
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');
}
...
}
API
Static access to the Voice API.
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. |
Events
Callbacks that are invoked when a native event emitted.
Event Name | Description | Event | Platform |
---|---|---|---|
Voice.onActionEvent(event) | Invoked when SpeechRecognizer stops recognition. | { error: false } |
Android, iOS |