Skip to content

feat: support custom LinearGradient component via prop#154

Open
androxxe wants to merge 1 commit intochramos:masterfrom
androxxe:feat/custom-linear-gradient-prop
Open

feat: support custom LinearGradient component via prop#154
androxxe wants to merge 1 commit intochramos:masterfrom
androxxe:feat/custom-linear-gradient-prop

Conversation

@androxxe
Copy link
Copy Markdown

Problem

Users of Expo (or any other environment) cannot use this library out of the box
because it hardcodes react-native-linear-gradient, which is not compatible with
Expo's expo-linear-gradient.

Solution

Accept a LinearGradient component as a prop, allowing users to pass any compatible
gradient library. Defaults to react-native-linear-gradient so existing usage is
fully backwards compatible.

Usage (Expo)

import { LinearGradient } from 'expo-linear-gradient';
import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
<SkeletonPlaceholder LinearGradient={LinearGradient}>
  <SkeletonPlaceholder.Item width={120} height={20} />
</SkeletonPlaceholder>
Changes
- src/skeleton-placeholder.tsx  added LinearGradient prop with react-native-linear-gradient as default
- package.json  marked react-native-linear-gradient as optional peer dependency
- README.md  documented the new prop and added Expo usage exampl

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

Successfully merging this pull request may close these issues.

1 participant