Home > OS >  Ionic/cordova-sms-plugin Open sms app with longer text, Ionic toolbar disappears
Ionic/cordova-sms-plugin Open sms app with longer text, Ionic toolbar disappears

Time:11-03

I am using cordova-sms-plugin to send sms from my ionic app. When I send a text which is shorter, everything works as expected but when text is longer and sms app opens, coming back to app will hide the toolbar irrespective of whether I sent the sms or not.

When inspected in Safari, I can see the toolbar if I add padding-top from ion-safe-area-top to 162px.

I have tried hiding/showing statusbar with no success.

ios: 15

CodePudding user response:

For now I have fixed with some css.

sms(phoneNumbers: string[], message: string) {
        return new Promise((resolve, reject) => {
            const options = {
                android: {
                    intent: 'INTENT',
                },
            };

            document.body.style.height = '100%';
            document.body.style.marginTop = '0px';

            this.smsPlugin
                .send(phoneNumbers, this.parseMessage(message), options)
                .then(
                    () => {
                        resolve('success');
                    },
                    () => {
                        reject('error');
                    }
                )
                .finally(() => {
                    setTimeout(() => {
                        const bodyHeight = document.body.offsetHeight;
                        const deviceHeight = window.screen.height;
                        document.body.style.marginTop = bodyHeight - deviceHeight   'px';
                        document.body.style.height = deviceHeight   'px';
                    }, 200);
                });
        });
    }

Here is the link of reported bug on Ionic Github.

https://github.com/ionic-team/ionic-framework/issues/24135

  • Related