javascript - 将图像添加到node_modules包

标签 javascript reactjs react-native node-modules

我正在使用react-native模块(React-native-pjsip)的fork,并且需要在通知中使用以下图像:

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "")
    .setContentTitle("My app Name")
    .setSmallIcon(android.R.drawable.ic_launcher)
    .setContentText("The app is running on foreground!")
    .setContentIntent(openAppPendingIntent)
    .addAction(action)
    .setOngoing(true)
    .setPriority(NotificationCompat.PRIORITY_MIN);



问题是:
没有可绘制的文件夹,并且我没有创建一个成功的文件夹。

ic_launcher文件是我自己的应用程序图标,通知运行良好,唯一的问题是自定义图标本身。

我编译时的错误是:

error: cannot find symbol
                .setSmallIcon(android.R.drawable.ic_launcher)
                                                ^
  symbol:   variable ic_launcher
  location: class drawable

最佳答案

解决方案是:使用“ R.drawable.ic_launcher”代替“ android.R.drawable.ic_launcher”

关于javascript - 将图像添加到node_modules包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58844226/

相关文章:

javascript - 映射对象数组并根据名字进行过滤

javascript - 为什么一些导入的 React-Native Redux 操作会多次更改值并触发 onEffects?

javascript - Cordova 应用程序 (iOS) 中的 iframe history.back() 问题

javascript - jScrollPane 停止使用 .append() 插入子元素

Javascript HTML5 数组搜索并从 HTML5 文本框返回(如果在数组中)

javascript - React JS如何让dangerouslySetInnerHTML中的脚本执行

reactjs - 在 Interval 内更新 React State 变量

javascript - React Native 从另一个文件导入函数

reactjs - 如何从其他组件更新状态?

javascript - 在 NodeJS 中,如何与另一台可能已关闭的服务器重新建立套接字连接?