react-speech icon indicating copy to clipboard operation
react-speech copied to clipboard

styles props doesn't work

Open elyasmotazedy opened this issue 4 years ago • 2 comments

when i use styles and pass style it throw me an error

elyasmotazedy avatar Jun 15 '20 11:06 elyasmotazedy

When I copy and paste this

const style = {
  play: {
    button: {
      width: '28',
      height: '28',
      cursor: 'pointer',
      pointerEvents: 'none',
      outline: 'none',
      backgroundColor: 'yellow',
      border: 'solid 1px rgba(255,255,255,1)',
      borderRadius: 6
    },
  }
};

I get an error

TypeError: Cannot read property 'button' of undefined

arnabsen1729 avatar Jul 04 '20 16:07 arnabsen1729

I was also seeing 'button' of undefined and 'pointerEvents' of undefined. Looking at src/speech it appears play, stop, pause, and resume all need button and button.pointerEvents properties. styles: { play: { button: { pointerEvents: { $set: play } } }, stop: { button: { pointerEvents: { $set: stop } } }, pause: { button: { pointerEvents: { $set: pause } } }, resume: { button: { pointerEvents: { $set: resume } } } } I edited the example Styles code to remove the play object for pause, stop, and resume and added a button property with empty object to pause and don't get the errors.

    container: {},
    text: {},
    buttons: {},
    play: {
      hover: {
        backgroundColor: 'GhostWhite',
      },
      button: {
        cursor: 'pointer',
        pointerEvents: 'none',
        outline: 'none',
        backgroundColor: 'Gainsboro',
        border: 'solid 1px rgba(255,255,255,1)',
        borderRadius: 6,
      },
    },
    pause: {
      hover: {},
      button: {},
    },
    stop: {
      hover: {},
      button: {},
    },
    resume: {
      hover: {},
      button: {},
    },
  };```

ptrollins avatar Jul 31 '20 12:07 ptrollins