0.0.22 • Published 6 years ago

react-obf v0.0.22

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

react-obf

react-obf is an Open Board Format renderer.

NPM

Features

  • Supports OBF natively
  • Full control over button rendering
  • Grid size
  • Grid order
  • LTR / RTL direction,
  • Scanning mode

Install

npm install --save react-obf

Basic Usage

import React, { Component } from 'react';
import { Board, Tile } from 'react-obf';

import boardSet from './communikate-20.json';

class Example extends Component {
  state = {
    board: boardSet.boards[boardSet.root]
  };

  speak(text) {
    const utterance = new SpeechSynthesisUtterance(text);
    window.speechSynthesis.speak(utterance);
  }

  loadBoard = board => {
    this.setState({ board: boardSet.boards[board.id] });
  };

  renderButton(button) {
    return <Tile {...button} />;
  }

  render() {
    return (
      <Board
        board={this.state.board}
        onLoadBoard={this.loadBoard}
        onSpeak={this.speak}
        renderButton={this.renderButton}
      />
    );
  }
}

Props

PropTypeRequiredDescription
backspaceButtonObjectComponent to render output backspace button.
boardObjectBoard to display, needs to be Open Board Format compliant.
clearButtonObjectComponent to render output clear button.
dirStringBoard direction, one of: ltr, rtl.
navbarObjectComponent to render navigation bar.
onLoadBoardFunctionCallback, fired when requesting to load board.
onOutputChangeFunctionCallback, fired when output changes.
onPlaySoundFunctionCallback, fired when requesting to play sound.
onSpeakFunctionCallback, fired when requesting to speak.
outputArrayOutput to display.
outputHiddenBooleanWhen true, output is hidden.
renderButtonFunctionBoard button renderer
scanIntervalNumberSets the scan rate interval when scanning is true.
scanningBooleanWhen true, scanner is activated.
sizeStringUI size.
toolbarObjectComponent to render toolbar.

backspaceButton (optional)

board (required)

clearButton (optional)

dir (optional)

navbar (optional)

onLoadBoard (optional)

onOutputChange (optional)

onPlaySound (optional)

onSpeak (optional)

output (optional)

renderButton (required)

scanInterval (optional)

scanning (optional)

size (optional)

toolbar (optional)

License

MIT

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.1

6 years ago