Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-skeleton-simpler
Advanced tools
A simple and fully customizable React Native component that implements a skeleton-like loader
React Native Skeleton Simpler, a simple yet fully customizable component made to achieve loading animation in a Skeleton-style. Works in both iOS and Android.
npm install react-native-skeleton-simpler
or
yarn add react-native-skeleton-simpler
import {SkeletonSimpler} from 'react-native-skeleton-simpler';
Custom Layout : You provide a prop layout
to the component specifying the size of the bones (see the Examples section below). Below is an example with a custom layout.
Custom Layout : You provide a prop SkeletonComponent
recommended for complex layouts.
Child Layout (in Development): The component will figure out the layout of its bones with the dimensions of its direct children. :construction:
export default function Placeholder() {
return (
<SkeletonSimpler
containerStyle={{ flex: 1, width: 300 }}
isLoading={true}
layout={[
{ width: 220, height: 20, marginBottom: 6 },
{ width: 180, height: 20, marginBottom: 6 }
]}
>
<Text>Your content</Text>
<Text>Other content</Text>
</SkeletonSimpler>
);
}
isLoading
to your state to show/hide the SkeletonSimpler when the assets/data are available to the user.export default function Placeholder () {
const [loading, setLoading] = useState(true);
return (
<SkeletonSimpler
containerStyle={{flex: 1, width: 300}}
isLoading={isLoading}>
{...otherProps}
/>
)
}
Name | Type | Default | Description |
---|---|---|---|
isLoading | bool | required | Shows the Skeleton bones when true |
layout | array of objects | [] | A custom layout for the Skeleton bones |
duration | number | 1000 ms | Duration of one cycle of animation |
containerStyle | object | flex: 1 | The style applied to the View containing the bones |
SkeletonComponent | React.JSX.Element | not required | Custom Componente of skeleton, recommended for complex layouts. |
theme | string (light or dark) | light | Theme of SkeletonSimpler and SkeletonItem |
animatedConfig | object of Animated.TimingAnimationConfig | {toValue: 1, duration: 1000, seNativeDriver: false, delay: 800} | Configs of Animated.timing |
1 - Customizing the layout of the bones (layout prop) :
export default function Placeholder () {
return (
<SkeletonContent
layout={[
// long line
{ width: 220, height: 20, marginBottom: 6 },
// short line
{ width: 180, height: 20, marginBottom: 6 },
...
]}
isLoading={true}>
...
/>
)
}
2 - Customizing the layout with props SkeletonComponent :
2.1 import SkeletonSimpler and SkeletonItem
import {SkeletonSimpler, SkeletonItem} from 'react-native-skeleton-simpler';
2.2 Create your custom SKeleton component using SkeletonItem
const SkeletonComponent = () => (
<View style={{ flexDirection: 'row',
alignItems: 'center',
marginTop: 10,
justifyContent: 'space-between',
}}>
<View>
<SkeletonItem
style={[
styles.common,
{
width: 150,
height: 15,
borderRadius: 10,
marginTop: 10,
},
]}
/>
<SkeletonItem
style={[
styles.common,
{
width: 200,
height: 15,
borderRadius: 10,
marginTop: 10,
},
]}
/>
</View>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
}}>
<SkeletonItem
style={[
styles.circle,
{marginLeft: 10, width: 40, height: 40},
]}
/>
</View>
</View>
)
2.3 Pass your custom component in SkeletonComponent prop
export const SkeletonSimplerExample = () => {
const [loading, setLoading] = useState(true);
useEffect(() => {
setTimeout(() => setLoading(false), 3000);
}, []);
return (
<SkeletonSimpler loading={loading} SkeletonComponent={SkeletonLoader}>
<View>
<Text>Your children</Text>
</View>
</SkeletonSimpler>
);
};
FAQs
A simple and fully customizable React Native component that implements a skeleton-like loader
The npm package react-native-skeleton-simpler receives a total of 25 weekly downloads. As such, react-native-skeleton-simpler popularity was classified as not popular.
We found that react-native-skeleton-simpler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.