Skip to content

Instantly share code, notes, and snippets.

@Karthik-B-06
Created May 23, 2020 13:24
Show Gist options
  • Save Karthik-B-06/12da42ed6f223c0247c9e3b7a34995eb to your computer and use it in GitHub Desktop.
Save Karthik-B-06/12da42ed6f223c0247c9e3b7a34995eb to your computer and use it in GitHub Desktop.
Just a Loader Component for React Native
import React from 'react';
import { Dimensions } from 'react-native';
import { Circle, Rect } from "react-native-svg";
import ContentLoader from 'rn-content-loader';
export const deviceWidth = Dimensions.get('window').width;
const LoaderComponent = props => (
<ContentLoader
height={200}
width={(deviceWidth - 70) / 2}
speed={2}
primaryColor="#f3f3f3"
secondaryColor="#ecebeb"
{...props}
>
<Rect x="70" y="15" rx="4" ry="4" width="117" height="6.4" />
<Rect x="70" y="35" rx="3" ry="3" width="85" height="6.4" />
<Rect x="0" y="80" rx="3" ry="3" width="250" height="6.4" />
<Rect x="0" y="100" rx="3" ry="3" width="250" height="6.4" />
<Rect x="0" y="120" rx="3" ry="3" width="250" height="6.4" />
<Circle cx="30" cy="30" r="30" />
</ContentLoader>
)
export default LoaderComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment