0

I want to use window.webkit.messageHandlers.xxx ,call the xxx iOS method . like this in React:

import React,{ Component } from 'react';

   .....

 componentDidMount() {
        window.webkit.messageHandlers.test.postMessage("Did finish loading");
    }

but compile error:

 Uncaught TypeError: Cannot read property 'messageHandlers' of undefined

what should I import ?

Yi Jerry
  • 1
  • 1
  • This question might help: https://stackoverflow.com/questions/32771215/wkwebkit-javascript-on-loaded-page-finds-window-webkit-is-undefined – Abir Taheer Dec 07 '20 at 02:59
  • https://stackoverflow.com/questions/54745833/cannot-read-property-messagehandlers-of-undefined – Ruan Duarte Dec 07 '20 at 03:03

0 Answers0