chramos / react-native-skeleton-placeholder

SkeletonPlaceholder is a React Native library to easily create an amazing loading effect.
MIT License
682 stars 121 forks source link

Skeleton placeholder doesn't resize with parent container #127

Open ltsai-tb opened 11 months ago

ltsai-tb commented 11 months ago

If the parent container of the skeleton placeholder changes width and the placeholder takes a width based on its parent, the placeholder only resizes on iOS on decrease instead of dynamic increase/decrease for both platforms.

  const handleLayout = (event) => {
    const { width } = event.nativeEvent.layout;
    setLoaderWidth(width - 100)
  };

  return (
    <View >
      <View width={containerWidth} onLayout={handleLayout}>
        <SkeletonPlaceholder>
          <SkeletonPlaceholder.Item width={loaderWidth} height={200} />
        </SkeletonPlaceholder>
      </View>
    </View>
  );
video -
Android Fixed on container width increase and decrease
iOS Fixed on container width increase, dynamic on decrease
mathewpatten commented 10 months ago

Having issues with this as well relating to orientation change