Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Le Tom authored and Le Tom committed Sep 2, 2020
1 parent 022e2f1 commit 094ab9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import React, { PureComponent, Component } from 'react';
import { View, Text, StyleSheet, Animated, Image, ScrollView, FlatList } from 'react-native';
import { LinearGradient } from 'expo-linear-gradient';
import Shimmer, { createShimmerPlaceholder } from './src/ShimmerPlaceholder'

const ShimmerPlaceholder = createShimmerPlaceholder(LinearGradient)
import ShimmerPlaceholder from './src/ShimmerPlaceholder'

const FacebookContent = ({ isReversed, shimmerColors, hasData, hasBorder, randomWidth }) => {
// Handle visible
Expand Down
8 changes: 6 additions & 2 deletions example/src/ShimmerPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const BasedShimmerPlaceholder = (props) => {
style,
shimmerStyle,
isInteraction = true,
LinearGradient,
LinearGradient = global.Expo
? global.Expo.LinearGradient
: View,
children,
animatedValue,
beginShimmerPosition,
Expand Down Expand Up @@ -118,6 +120,8 @@ const styles = StyleSheet.create({

});

export const createShimmerPlaceholder = (LinearGradient) => React.forwardRef((props, ref) => <ShimmerPlaceholder LinearGradient={LinearGradient} ref={ref} {...props} />)
export const createShimmerPlaceholder = (LinearGradient = global.Expo
? global.Expo.LinearGradient
: View) => React.forwardRef((props, ref) => <ShimmerPlaceholder LinearGradient={LinearGradient} ref={ref} {...props} />)

export default ShimmerPlaceholder

0 comments on commit 094ab9c

Please sign in to comment.