英文:
The Ionic Native social sharing plugin keeps having issues with rxjs. What can I do to fix this issue?
问题
我已经在StackBlitz项目中遇到了这个问题。
https://stackblitz.com/edit/ionic6-angular13-yngs1m?file=src/app/app.component.css
每当我尝试使用这个插件时,都会收到一个关于Ionic Native不兼容的rxjs错误。我尝试过使用--force和--legacy-peer-deps安装它,还尝试过降级rxjs,但都不起作用。无论我做什么,rxjs的版本始终是7.8.0。
要在你自己的环境中重现这个问题:
- 创建一个新的空白Ionic项目,使用Angular。
- 使用
npm i @ionic-native/social-sharing@4
安装@ionic-native/social-sharing@4
插件。 - 在你的组件中导入该插件:
import { SocialSharing } from '@ionic-native/social-sharing';
。 - 在构造函数中实例化SocialSharing:
private socialSharing: SocialSharing
。
在我的情况下,当我运行应用程序时,就已经出现了rxjs的问题。
- 在一个方法中(在我的情况下是
share() {}
)中添加以下代码到ts文件中:
let options = {
subject: "主题",
message: "消息"
}
this.socialSharing.shareWithOptions(options);
请告诉我是否知道解决这个问题的方法。我的目标是能够使用图片的本地路径分享图片。点击分享按钮将调用share()
方法,并在iOS和Android上弹出本地分享窗口,用户可以选择使用哪个平台分享图片。
英文:
I have made a stackblitz project with the issue.
https://stackblitz.com/edit/ionic6-angular13-yngs1m?file=src/app/app.component.css
Whenever I try to use this plugin I get a rxjs error about incompatibility with Ionic Native. Ive tried installing it with --force and --legacy-peer-deps, and downgrading rxjs, which doesnt even work. Whatever I do, rxjs is always version 7.8.0.
To recreate this issue yourself in your own environment:
- Create a new blank Ionic project with Angular
- Install the
@ionic-native/social-sharing@4
plugin withnpm i @ionic-native/social-sharing@4
. - Import the plugin in your component with:
import { SocialSharing } from '@ionic-native/social-sharing'
. - Instantiate SocialSharing in the constructor with:
private socialSharing: SocialSharing
In my case, when I run the app I already get issues with rxjs.
- Add the following code to the ts in a method (in my case
share() {}
):
let options = {
subject: "Subject",
message: "Message"
}
this.socialSharing.shareWithOptions(options);
Let me know if you know a way to fix this issue. My goal is to be able to share images using their local path. Clicking the share button will call the share()
method and bring up the native share window for IOS and Android where users can select which platform they want to use to share the image
答案1
得分: 3
@ionic-native
已被弃用并捐赠给社区。现在它被称为 @awesome-cordova-plugins
,其第 6 版包括与最新版本的 rxjs 兼容性。
将任何 @ionic-native/whatever
包替换为其等效的 @awesome-cordova-plugins/whatever
。
英文:
@ionic-native
is deprecated and was donated to the community. It’s now called @awesome-cordova-plugins
, and versión 6 of it includes compatibility with latest rxjs.
Replace any @ionic-native/whatever
package with its equivalent @awesome-cordova-plugins/whatever
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论