如何添加“设为壁纸"React Native 应用程序中的选项 [英] How to add "Set as Wallpaper" option in React Native app

查看:29
本文介绍了如何添加“设为壁纸"React Native 应用程序中的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何启用设置为墙纸"选项?我正在使用 expo,但找不到任何 API 来启用该功能.我只能下载图片.我想触发设置为墙纸选项.我尝试使用 react-native-wallpaper-manager 库,但它对我不起作用.

How to enable option "set as wallpaper" ? I'm using expo and I'm not able to find any API to enable that functionality. I only able to download image. I want to trigger set as wallpaper option. I tried to use react-native-wallpaper-manager library but it has not worked for me.

推荐答案

我找到了使用 react-native-wallpaper-manager 通过弹出 CRNA .但似乎 npm 版本与 repo 不是最新的.要使其正常工作,您必须通过删除

I found the proper solution to 'set wallpaper' (in android) using react-native-wallpaper-manager by ejecting the CRNA . But it seems like the npm release is not up to date with the repo. To get it to work you will have to implement the last pull fix manually by removing

@Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

来自 WallPaperPackage.java 并确保通过 react-native link react-native-wallpaper-manager

注意:- 目前没有使用 expo 或 CRNA 的 api 来在 android 中设置为墙纸"

Note:- Right now there is no api working with expo or CRNA to 'set as wallpaper' in android

这篇关于如何添加“设为壁纸"React Native 应用程序中的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆