ionic-framework: bug: Open sms app with longer text, Ionic toolbar disappears. cordova-sms-plugin

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

I am using this cordova-sms-plugin to send sms from my 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.

Expected Behavior

Toolbar shoudlnt disappear. As per my understanding, size of webview is being changed on opening sms app with longer text.

Steps to Reproduce

install cordova-sms-plugin open sms app by using a longer text message to send. come back to app

Code Reproduction URL

No response

Ionic Info

Ionic: Ionic CLI : 6.14.1 (/Users/dijitalbrains/.nvm/versions/node/v12.16.1/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.6.6 @angular-devkit/build-angular : 0.1002.3 @angular-devkit/schematics : 10.2.3 @angular/cli : 10.2.3 @ionic/angular-toolkit : 3.1.1

Capacitor: Capacitor CLI : 3.2.5 @capacitor/core : 3.2.5

Utility: cordova-res (update available: 0.15.3) : 0.15.1 native-run : 1.5.0

System: NodeJS : v12.16.1 (/Users/dijitalbrains/.nvm/versions/node/v12.16.1/bin/node) npm : 6.13.4 OS : macOS Big Sur

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@sean-perkins Thanks. Issue is fixed for me.

@umairrafiq1133 @subhankhalid402

I have found a resolution to the issue. It appears that both MFMessageComposeViewController and MFMailComposeViewController will cause the webview to resize between iOS 14 to 15.

You will need to install @capacitor/keyboard into your project(s) to resolve this issue.

npm i @capacitor/keyboard

Next, before you open the SMS plugin/keyboard, set the resize behavior to none.

import { Keyboard, KeyboardResize } from '@capacitor/keyboard';

...

async openSmsApp() {
  await Keyboard.setResizeMode({
    mode: KeyboardResize.None
  });
  ...
  await this.smsPlugin.send(phoneNumbers, message, options);

  await Keyboard.setResizeMode({
    // Change this value if you aren't using ion-app
    mode: KeyboardResize.Ionic
  });

Remember to sync your capacitor plugins after installing the dependency.

npx cap sync ios

<video src="https://user-images.githubusercontent.com/13732623/141926563-c22019c5-de78-49fd-8e9f-86b013b4e39d.mp4"></video>

Let me know if this resolves the issue on your end. I’ve checked locally with both the Cordova and Capacitor plugin, on iOS 15.1