Skip to content

Instantly share code, notes, and snippets.

@zaguiini
Created January 5, 2018 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaguiini/1ee0274b2c4ddc7f1985f1d3a04350e8 to your computer and use it in GitHub Desktop.
Save zaguiini/1ee0274b2c4ddc7f1985f1d3a04350e8 to your computer and use it in GitHub Desktop.
...
window.onMessage = function(event) {
// now you'll follow with your callback
}
facebookLoginClicked() {
// how to post a message
switch(window.isNative) {
case 'android':
window.postMessage('facebookLogin')
break
case 'ios':
window.webkit.messageHandlers.reactNative.postMessage('facebookLogin')
break
default:
// not native
window.facebookLogin()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment