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

[Crash] only on release build style undefined

Open UberMC opened this issue 6 years ago • 3 comments

com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'r.View.propTypes.style'), stack:

Only happens on release build (Emulator and devices)

<SpeechBubble onSpeechReplay={()=>{ this.setState({showreward: false}); } } speeches={[ 'You leveled up!', 'You unlocked a background!' ]} />

UberMC avatar Jun 20 '18 06:06 UberMC

@UberMC How did you manage to bypass this?

shtefanilie avatar Jul 03 '19 10:07 shtefanilie

Fixed this by changing in the index.js file from the package from this

const propTypes = {
  allowSkip: PropTypes.bool,
  allowSpeechReplay: PropTypes.bool,
  onSpeechEnd: PropTypes.func,
  onSpeechNext: PropTypes.func,
  onSpeechReplay: PropTypes.func,
  speaker: PropTypes.string,
  speakerStyle: View.propTypes.style,
  speakerTextStyle: Text.propTypes.style,
  speechBubbleActiveOpacity: PropTypes.number,
  speechBubbleStyle: View.propTypes.style,
  speechBubbleTextStyle: View.propTypes.style,
  speeches: PropTypes.array.isRequired,
  typeWriterStyle: Text.propTypes.style,
  nextStyle: View.propTypes.style,
  style: View.propTypes.style,
  hideIcons: PropTypes.bool,
};

to this

const propTypes = {
  allowSkip: PropTypes.bool,
  allowSpeechReplay: PropTypes.bool,
  onSpeechEnd: PropTypes.func,
  onSpeechNext: PropTypes.func,
  onSpeechReplay: PropTypes.func,
  speaker: PropTypes.string,
  speakerStyle: ViewPropTypes.style,
  speakerTextStyle: Text.propTypes.style,
  speechBubbleActiveOpacity: PropTypes.number,
  speechBubbleStyle: ViewPropTypes.style,
  speechBubbleTextStyle: ViewPropTypes.style,
  speeches: PropTypes.array.isRequired,
  typeWriterStyle: Text.propTypes.style,
  nextStyle: ViewPropTypes.style,
  style: ViewPropTypes.style,
  hideIcons: PropTypes.bool,
};

shtefanilie avatar Jul 03 '19 10:07 shtefanilie

I'm also facing this issue. Using the fix from @shtefanilie I get the error: ViewPropTypes is not defined

OliverLSanz avatar Dec 17 '21 10:12 OliverLSanz