alabsi91 / reanimated-color-picker

A Pure JavaScript Color Picker for React Native
https://alabsi91.github.io/reanimated-color-picker/
MIT License
248 stars 16 forks source link

Shadow calculation of Swatch is inefficient #77

Closed MehediH closed 7 months ago

MehediH commented 8 months ago

Description

Getting this warniong with the <Swatches/> component:

WARN  (ADVICE) View #963 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.

Steps to reproduce

Use the <Swatches/> component like:

 <Swatches
     style={{ paddingTop: 10, paddingHorizontal: 10 }}
     swatchStyle={{
                shadowOpacity: enableSwatchShadow ? 0.2 : 0,
                shadowRadius: 4,
                width: 30,
                height: 30
     }}
     colors={SWATCHES_COLORS}
/>

Snack or a link to a repository

No response

Reanimated Color Picker version

3.0.1

React Native version

0.73.4

React Native Reanimated version

3.8.1

React Native Gesture Handler version

2.14.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo bare workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

alabsi91 commented 8 months ago

This warning is related to React Native on iOS. It occurs when a view lacks a background color (swatch color) property or has a transparent one. Additionally, it can happen when using a shadowOpacity of 0. Some solutions suggest putting the opacity in the shadowColor instead

MehediH commented 7 months ago

Thanks @alabsi91, this issue was unrelated to this component. Sorry about that!