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

React Native V0.71.0 Shadow Warnings #3593

Open
stakez opened this issue Jan 12, 2023 · 32 comments · Fixed by #3738
Open

React Native V0.71.0 Shadow Warnings #3593

stakez opened this issue Jan 12, 2023 · 32 comments · Fixed by #3738

Comments

@stakez
Copy link

stakez commented Jan 12, 2023

Current behaviour

Since upgrading to React Native 0.71.0, the following warning has been occurring
WARN (ADVICE) View #1853 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component.

After removing several React Native paper Components (especially Surface), the warnings dropped. After reverting to original, the warnings all return.

Expected behaviour

No warning should be shown.

How to reproduce?

Run a React Native App using V0.71.0 and view the terminal running react-native start

Preview

Screenshot 2023-01-12 at 1 37 48 PM

Your Environment

software version
react-native 0.71.0
react-native-paper ^5.1.2
node 18.12.1
npm or yarn yarn
expo sdk not applicable
@lukewalczak
Copy link
Member

As you noticed the issue comes form the Surface component where we are applying the elevation, but the views don't have a specified background color, that's why the warning appears. I will definitely check what we can do about it.

@stakez
Copy link
Author

stakez commented Jan 19, 2023

Thanks @lukewalczak. Looking toward to what you find.

@Yusk03
Copy link

Yusk03 commented Jan 22, 2023

Can agree
Have the same problem, hope you'll resolve it

@asurare
Copy link

asurare commented Feb 7, 2023

Having the same issue after a recent update. Is it open to PR ?

@lukewalczak
Copy link
Member

Is it open to PR ?

Sure, contributions are welcomed!

@visoft
Copy link

visoft commented Feb 23, 2023

This is happening with the Portal and Dialog components as well.

@Streudal
Copy link

Adding on to what @visoft mentioned: this is also happening with the FAB component as well. Basically anything that has a shadow built in it seems like.

@lukewalczak
Copy link
Member

We are aware of that issue and there is a PR which should fix the warning.

@lukewalczak
Copy link
Member

Version 5.5.0 has been released and the issue should be fixed :)

@Streudal
Copy link

Everything is lookin great! Thanks for the updates!

@ericpoulinnz
Copy link

@lukewalczak I'm still getting this warning in 5.5.2.

Seems to be the AnimatedFAB.

@spaskhalov
Copy link

spaskhalov commented Apr 3, 2023

I'm getting this warnings in 5.5.2, after setting buttonColor property for Button.

@nam3886
Copy link

nam3886 commented Jul 21, 2023

any update?

@CarlosSLoureiro
Copy link

someone know to ignore this warning from console/terminal?

@lukewalczak
Copy link
Member

lukewalczak commented Jul 25, 2023

I'm getting this warnings in 5.5.2, after setting buttonColor property for Button.

I was not able to reproduce it unfortunately with the Button

Seems to be the AnimatedFAB.

Correct, there is still the warning in AnimatedFAB, which is related to the component composition and its animation – it depends on transparent background color in the wrapper container, which triggers the warning. We are aware of that and will check what we can do about it.

someone know to ignore this warning from console/terminal?

The log is printed from react-native using RCTLogAdvice and I think there is no way to suppress it.

@ericpoulinnz
Copy link

ericpoulinnz commented Aug 10, 2023

We are aware of that and will check what we can do about it.

@lukewalczak is this something actively being investigated?

The log is printed from react-native using RCTLogAdvice and I think there is no way to suppress it.

I am handing over a project to a client with a technical person onboard and they are giving me grief about any warnings in the console. Suppressing is both challenging and now that they have seen the warning, potentially not viable for me.

@mertkahramanturk
Copy link

This error requires you to specify the background color of the element you want to shade.something like that:
backgroundColor: colors.white,
shadowColor: '#171717',
shadowOffset: {width: 1, height: 1},
shadowOpacity: 0.3,
shadowRadius: 5,

@fellenabmb
Copy link

This issue is still present. And just as the author, I narrowed it down to the Surface component.

image

Currently using:

    "react-native": "0.72.4"
    "react-native-paper": "^5.8.0"

@GoRRRRchik
Copy link

This issue is still present

react-native: 0.72.4

@brunoravizzinidev
Copy link

react-native: 0.71.8
react-native-paper: 5.10.0

This issue is present, I'm seeing it in the AnimatedFAB

@ramakula
Copy link

ramakula commented Oct 6, 2023

We are also seeing this:

WARN (ADVICE) View #46655 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component.
WARN (ADVICE) View #46653 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component.
WARN (ADVICE) View #48305 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component.
WARN (ADVICE) View #48303 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component.

@Fortidude
Copy link

Im seeing this as well. Any way to ignore / silence it?

@CostasCF
Copy link

Did you find any way to silence it?

@JeanBaptisteBolh
Copy link

@Fortidude @CostasCF I am also looking for a way to silence this.

@Abdeldmh
Copy link

Abdeldmh commented Jan 4, 2024

Still no fix for this ??

@abubakarasifmughal
Copy link

Im using this version "react-native-paper": "^5.11.6" and still facing this issue.

@Abdeldmh
Copy link

Abdeldmh commented Jan 9, 2024

Hi ! I've finally identified the issue. Initially, I thought it might be related to react-native-paper, but after explore other possibilities. It turns out that when you set backgroundColor: 'transparent' on some components like Views, it triggers the warning. The solution? I added shadowColor: 'transparent', and voila, the issue was resolved! 😄

@R4tch3t
Copy link

R4tch3t commented Jan 19, 2024

Hi ! I've finally identified the issue. Initially, I thought it might be related to react-native-paper, but after explore other possibilities. It turns out that when you set backgroundColor: 'transparent' on some components like Views, it triggers the warning. The solution? I added shadowColor: 'transparent', and voila, the issue was resolved! 😄

not work :/ react-native: 0.73.2, react-native-paper: 5.12.1

@R4tch3t
Copy link

R4tch3t commented Jan 19, 2024

only adding the backgroundColor to the elevated component :/

@fellenabmb
Copy link

This issue is still present!.

@JuMaruhn
Copy link

JuMaruhn commented Mar 4, 2024

If you do not need the functionalities of the Surface component, you can go to the AnimatedFAB.tsx and replace the <Surface> component by a <Animated.View> component.

@devonik
Copy link

devonik commented Jul 21, 2024

For me it was the elevated style of a react-native-elements Icon.

When I remove the raised the warning it's gone.

Result: As the advise says I set the backgroundColor and the warning is gone
<Icon raised containerStyle={{ backgroundColor: theme.colors.white }} />

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