I am wrapping my plugin calls in try/catches to avoid promise rejections being uncaught, but this doesn't seem to be working:
try {
const { Keyboard } = Plugins
Keyboard.setAccessoryBarVisible({ isVisible: true })
} catch (error) {
// Keyboard isn't available on web so we need to swallow the error
}
Uncaught (in promise) Keyboard does not have web implementation.
Affected platform
OS of the development machine
Other information:
Capacitor version: 1.1.1
node version: v10.15.3
npm version: 6.4.1
This is how I fixed this issue
let Keyboard;
if (Capacitor.platform !== "web") {
Keyboard = Plugins.Keyboard
}
Thank you so much! I wasn't aware of Capacitor.platform and it's use has solved a lot of other conditional headaches for me!
You can also use Capacitor.isPluginAvailable
Most helpful comment
This is how I fixed this issue