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 react-native-wallpaper-manager library. The original repository is currently not maintained and lacks TypeScript support.
You can install this package via npm:
npm install react-native-wallpaper-util
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);
- This package is designed for Android OS and is not compatible with iOS.
- 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.
- The original code and inspiration for this package come from Ajay Bhatia's react-native-wallpaper-manager repository.
- This package was created to provide enhanced functionality and TypeScript support.
##License This package is open-source and available under the MIT License.