简体   繁体   English

如何解决 index.js:9 Uncaught TypeError: Cannot read property 'setWallpaper' of undefined?

[英]How to resolve index.js:9 Uncaught TypeError: Cannot read property 'setWallpaper' of undefined?

Hello All I'm new to react native and started with wallpaper app.大家好,我是本机反应的新手,并开始使用壁纸应用程序。 I'm using react-native-wallpaper-manager to built an App and I'm getting following error:我正在使用react-native-wallpaper-manager构建一个应用程序,但出现以下错误:

index.js:9 Uncaught TypeError: Cannot read property 'setWallpaper' of undefined index.js:9 未捕获的类型错误:无法读取未定义的属性“setWallpaper”

index.js索引.js

var  NativeModules = require('react-native');
var Image  = require('react-native');

module.exports = {
setWallpaper: (source,callback = (res)=>{
    console.log(res);
}) =>{
    NativeModules.WallPaperManager.setWallpaper(Image.resolveAssetSource(source),callback);
 }
 } ;

App.js应用程序.js

 WallPaperManager.setWallpaper({uri: 'img_link', screen: 'both/home/lockscreen'}, (res)=> console.log(res));

Please help me to resolve this error.请帮我解决这个错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 index.js:33 未捕获的类型错误:无法在 loadQuiz 中读取未定义的属性“问题”(index.js:33) - index.js:33 Uncaught TypeError: Cannot read property 'question' of undefined at loadQuiz (index.js:33) index.js:8 未捕获类型错误:无法读取 index.js:8 处未定义的属性“addEventListener”, - index.js:8 Uncaught TypeError: Cannot read property 'addEventListener' of undefined at index.js:8, Index.js:46 未捕获的类型错误:无法读取未定义的属性“生活方式” - Index.js:46 Uncaught TypeError: Cannot Read Property 'lifestyle' Of Undefined index.js:28 未捕获类型错误:无法读取 null 的属性“addEventListener”(在 toggleActiveOnClick 和 Array.forEach 中) - index.js:28 Uncaught TypeError: Cannot read property 'addEventListener' of null ( at toggleActiveOnClick and at Array.forEach) TypeError:无法读取Gatsby中未定义的…src / pages / index.js的属性“数据” - TypeError: Cannot read property 'data' of undefined …src/pages/index.js in Gatsby TypeError:无法读取 Socket 未定义的属性“房间”。<anonymous> (C:\CHAT\server\index.js:22:21)</anonymous> - TypeError: Cannot read property 'room' of undefined at Socket.<anonymous> (C:\CHAT\server\index.js:22:21) Chaplin.js-未捕获的TypeError:无法读取未定义的属性“未定义” - Chaplin.js - Uncaught TypeError: Cannot read property 'undefined' of undefined 如何解决Uncaught TypeError:无法读取全局变量undefined的属性“ length”? - How do I resolve the Uncaught TypeError: Cannot read property 'length' of undefined of my Global varible? 如何解决链 select 未捕获的类型错误:无法读取未定义的属性“forEach” - How to resolve problem with chain select Uncaught TypeError: Cannot read property 'forEach' of undefined 未捕获的类型错误:无法在 HTMLButtonElement 处设置 null 的属性“textContent”。<anonymous> (index.js:17),为什么会这样?</anonymous> - Uncaught TypeError: Cannot set property 'textContent' of null at HTMLButtonElement.<anonymous> (index.js:17), why is it happening?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM