React Native Wallpaper Utility Function

This utility function provides a simple way to set wallpapers on your React Native application. It is an enhanced version based on the work of Ajay Bhatia, who originally created the @ajaybhatia/react-native-wallpaper-manager library. The original repository is currently not maintained and lacks TypeScript support.

Installation

You can install this package via npm:

npm install react-native-wallpaper-util # for npm
pnpm install react-native-wallpaper-util # for pnpm
yarn add react-native-wallpaper-util # for yarn
bun add react-native-wallpaper-util # for bun

Usage

Here's how you can use the setWallpaper function to set wallpapers:

import { setWallpaper } from "react-native-wallpaper-util";

// Define the image source and callback function
const imageSource = {
  uri: "your-image-uri",
  screen: "home", // or "lock", or "both"
};

const callback = () => {
  console.log("Wallpaper set successfully.");
};

// Set the wallpaper
setWallpaper(imageSource, callback);

Platform-Specific FAQs

Platform Compatibility

  • This package is designed for Android OS and is not compatible with iOS.

Expo Compatibility

  • This package can be used with Expo, but please note that it will only work when you use the development client or build a standalone APK.
  • It will not work with the Expo Go app.

Credits

License

This package is open-source and available under the MIT License.