Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled JS Exception on fixed={true} #8

Closed
sobstel opened this issue May 3, 2017 · 3 comments
Closed

Unhandled JS Exception on fixed={true} #8

sobstel opened this issue May 3, 2017 · 3 comments

Comments

@sobstel
Copy link
Contributor

sobstel commented May 3, 2017

ERROR: "Unhandled JS Exception: In this environment the sources for assign MUST be an object.This error is a performance optimization and not spec compliant."

StyleSheet.create doesn't return a plain javascript object, so the "..." operator sometimes can't be applied. See: https://github.com/TaylorBriggs/react-native-typewriter/blob/master/index.js#L147.

As invisibleStyles are created separately anyway so it might be good to remove "style" from props or to use StyleSheet.flatten.

Original code that doesn't work:

        <TypeWriter
          typing={1}
          minDelay={15}
          maxDelay={60}
          fixed={true}
          style={styles.text}
          onTyped={(token) => this.props.onTyped(token)}
          {...this.props}>
          {text}
        </TypeWriter>
const styles = EStyleSheet.create({
  text: {
    fontFamily: '$textFont',
    fontSize: responsiveFontSize(2),
    color: '#bbb'
  }
});

Fix/workaround that works

(...)
style={StyleSheet.flatten(styles.text)}
(...)
@TaylorBriggs
Copy link
Owner

Sorry for shipping a bug! I believe this change will fix it by concatenating the styles into an array instead of trying to extend the object.

@sobstel
Copy link
Contributor Author

sobstel commented May 3, 2017

Thanks for quick feedback! This solves the issue.

@TaylorBriggs
Copy link
Owner

de34410 should fix it. A patch release is coming soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants