An open API service indexing awesome lists of open source software.

https://github.com/pioner92/react-native-auto-skeleton

🚀 Automatically generates skeleton based on your existing UI layout without manual configuration.
https://github.com/pioner92/react-native-auto-skeleton

fabric loader native-component react-native react-native-loader react-native-placeholder react-native-skeleton react-native-ui skeleton skeleton-loader

Last synced: about 2 months ago
JSON representation

🚀 Automatically generates skeleton based on your existing UI layout without manual configuration.

Awesome Lists containing this project

README

        

# react-native-auto-skeleton

**`react-native-auto-skeleton`** Provides automatic skeleton loading indicators based on your existing UI components, without manual configuration..

⚠️ **Currently supports only iOS. Android support is coming soon.**

## Demo


react-native-auto-skeleton demo

## Installation

Using npm:
```bash
npm install react-native-auto-skeleton
```

Using yarn:
```bash
yarn add react-native-auto-skeleton
```

## Usage

Here's a quick example to get started:

```tsx

import { AutoSkeletonView, AutoSkeletonIgnoreView } from 'react-native-auto-skeleton';
...

...YOUR VIEWS
// Content that will be ignored by the skeleton
... Views without skeleton

```

Full example

```tsx
import { AutoSkeletonView } from 'react-native-auto-skeleton';

interface IProfile {
name: string;
jobTitle: string;
avatar: string;
}

const getProfile = async (): Promise => {
// Fetch profile data from your API
};

export default function App() {
const [isLoading, setIsLoading] = useState(true);
const [profile, setProfile] = useState({} as IProfile);

useEffect(() => {
(async () => {
const res = await getProfile();
setProfile(res);
setIsLoading(false);
})();
}, []);

return (




{profile.name}
{profile.jobTitle}

{/* This buttons block will have skeleton applied */}


Add


Delete

{/* Alternatively, to exclude buttons from skeleton rendering: */}


...



);
}
```

## API

| Prop | Type | Default | Description |
|---------------------------|---------|---------|-----------------------------------------------------------------------------------------------|
| `isLoading` | boolean | — | Enables or disables the skeleton state. When `true`, skeleton placeholders will be shown. |
| `shimmerSpeed` | Float | `1.0` | Duration of one shimmer animation cycle **in seconds**. Lower values = faster shimmer. |
| `shimmerBackgroundColor` | string | `#C7C7CC` | Background color of skeleton shapes in **hex format** (e.g., `#E0E0E0`). |
| `defaultRadius` | Float | `4` | Default corner radius for skeleton elements that don't have a defined `borderRadius`. |

## Best Practices

- For rapid implementation, wrap entire UI sections with ``.
- For precise control, wrap individual UI components or groups separately.
- Ensure components have clearly defined dimensions, backgrounds, or styles for optimal skeleton rendering.
- To exclude specific components from skeleton rendering, wrap them with ``. Any content inside this wrapper will not be processed by the skeleton system.

## License

[MIT](LICENSE)