tomzaku / react-native-shimmer-placeholder

Placeholder/ Skeleton of React Native
MIT License
1.06k stars 93 forks source link

LinearGradient colors and locations props should be arrays of the same length (Warning) #70

Closed vishal-bhil closed 2 years ago

vishal-bhil commented 3 years ago
Screenshot 2021-11-16 at 11 02 57 PM
tomzaku commented 3 years ago

Could you give us the sample code?

godlewski commented 2 years ago

I'm seeing this same issue, here's some sample usage code:


type Props = {} & ShimmerPlaceholderProps;

export default function ShimmerPlaceholder({ ...props }: Props) {
  const Placeholder = createShimmerPlaceholder(LinearGradient);
  const animationRef = React.createRef<any>();

  useEffect(() => {
    const animated = Animated.stagger(400, [
      animationRef.current.getAnimated(),
    ]);
    Animated.loop(animated).start();
  }, [animationRef]);

  return <Placeholder ref={animationRef} {...props} />;
}
arnavpanwar99 commented 8 months ago

try keeping location={null} if you don't want to explicitly set the gradient locations and get rid of the warning message.