Skip to content

Commit

Permalink
Add testID for easier testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeikko committed Mar 2, 2021
1 parent 5ac7210 commit 1dd4041
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -19,6 +19,7 @@ declare module 'react-native-shimmer-placeholder' {
contentStyle?: any;
isInteraction?: boolean;
LinearGradient?: React.ComponentClass<any>;
testID?: string;
}

class ShimmerPlaceholder extends React.Component<ShimmerPlaceholderProps, any> {
Expand Down
2 changes: 2 additions & 0 deletions lib/ShimmerPlaceholder.js
Expand Up @@ -54,6 +54,7 @@ const BasedShimmerPlaceholder = (props) => {
animatedValue,
beginShimmerPosition,
shimmerWidthPercent = 1,
testID
} = props

const linearTranslate = beginShimmerPosition.interpolate({
Expand Down Expand Up @@ -82,6 +83,7 @@ const BasedShimmerPlaceholder = (props) => {
return (
<View
style={[!visible && { height, width }, styles.container, !visible && shimmerStyle, style]}
testID={testID}
>
{/* Force render children to restrict rendering twice */}
<View style={[!visible && { width: 0, height: 0, opacity: 0 }, visible && contentStyle]}>{children}</View>
Expand Down

0 comments on commit 1dd4041

Please sign in to comment.