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

ShadowFlex doesn't update on props change #30

Open
xPapla opened this issue Jun 23, 2020 · 3 comments
Open

ShadowFlex doesn't update on props change #30

xPapla opened this issue Jun 23, 2020 · 3 comments

Comments

@xPapla
Copy link

xPapla commented Jun 23, 2020

ShadowFlex component does not seem to be processing props change thus not always rendering properly.

This added to ShadowFlex.js seems to fix it.

  componentDidUpdate(_prevProps, prevState) {
    const { style } = this.props;

    if (
      prevState?.shadowStyle?.shadowOffset !== style?.shadowOffset ||
      prevState?.shadowStyle?.shadowOpacity !== style?.shadowOpacity ||
      prevState?.shadowStyle?.shadowRadius !== style?.shadowRadius ||
      prevState?.shadowStyle?.shadowColor !== style?.shadowColor ||
      prevState?.shadowStyle?.borderRadius !== style?.borderRadius ||
      prevState?.shadowStyle?.backgroundColor !== style?.backgroundColor
    )
      this.setState({
        ...prevState,
        shadowStyle: {
          ...prevState?.shadowStyle,
          shadowOffset: style?.shadowOffset,
          shadowOpacity: style?.shadowOpacity,
          shadowRadius: style?.shadowRadius,
          shadowColor: style?.shadowColor,
          borderRadius: style?.borderRadius,
          backgroundColor: style?.backgroundColor,
        },
      });
  }
@koyin
Copy link

koyin commented Feb 23, 2021

Same problem here, is there any updates?

@xPapla
Copy link
Author

xPapla commented Feb 23, 2021

I ended up using patch-package and fixed the package using above snippet

@YoniKurtz
Copy link

Same problem for me, any updates?

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

3 participants