{"action":"closed","issue":{"url":"https://api.github.com/repos/doolse/purescript-reactnative/issues/22","repository_url":"https://api.github.com/repos/doolse/purescript-reactnative","labels_url":"https://api.github.com/repos/doolse/purescript-reactnative/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/doolse/purescript-reactnative/issues/22/comments","events_url":"https://api.github.com/repos/doolse/purescript-reactnative/issues/22/events","html_url":"https://github.com/doolse/purescript-reactnative/issues/22","id":330860131,"node_id":"MDU6SXNzdWUzMzA4NjAxMzE=","number":22,"title":"How to call asynchronous functions from `createLifecycleComponent`'s eval function ?","user":{"login":"omefire","id":4992035,"node_id":"MDQ6VXNlcjQ5OTIwMzU=","avatar_url":"https://avatars3.githubusercontent.com/u/4992035?v=4","gravatar_id":"","url":"https://api.github.com/users/omefire","html_url":"https://github.com/omefire","followers_url":"https://api.github.com/users/omefire/followers","following_url":"https://api.github.com/users/omefire/following{/other_user}","gists_url":"https://api.github.com/users/omefire/gists{/gist_id}","starred_url":"https://api.github.com/users/omefire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omefire/subscriptions","organizations_url":"https://api.github.com/users/omefire/orgs","repos_url":"https://api.github.com/users/omefire/repos","events_url":"https://api.github.com/users/omefire/events{/privacy}","received_events_url":"https://api.github.com/users/omefire/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-09T06:56:30Z","updated_at":"2018-06-13T20:47:44Z","closed_at":"2018-06-13T20:47:44Z","author_association":"NONE","body":"I have been trying for hours to make a call to a JS function that returns a Promise from within an action evaluator.\r\nMy code looks like this:\r\n\r\n1- Linking.js:\r\n```\r\nconst RN = require('react-native');\r\nexports.getInitialURLImpl = function(v) {\r\n   return RN.Linking.getInitialURL();\r\n}\r\n```\r\n\r\n2- Linking.purs:\r\n\r\n```\r\nforeign import data LINKING :: Effect\r\nforeign import getInitialURLImpl :: forall eff. Unit -> Eff eff (Promise String)\r\n\r\ngetInitialURL :: forall eff. Aff (linking :: LINKING | eff) String\r\ngetInitialURL = liftEff (getInitialURLImpl unit) >>= toAff\r\n```\r\n\r\n3- Main.purs:\r\n\r\n```\r\ninitialState = {}\r\ndata Action = HandleDeepLinking\r\napp :: forall p. ReactClass p\r\napp = createLifecycleComponent (didMount $ HandleDeepLinking) initialState render2 eval\r\n  where\r\n    eval (HandleDeepLinking) = void $ launchAff do\r\n        x <- getInitialURL\r\n        liftEff $ alert \"test\" (Just x)\r\n        pure unit\r\n```\r\n\r\nThe above fails at runtime:\r\n<img width=\"287\" alt=\"screen shot 2018-06-09 at 4 10 34 am\" src=\"https://user-images.githubusercontent.com/4992035/41189965-d28d0144-6b9b-11e8-8557-68e6bb6d0e44.png\">\r\n\r\nHelp!!!\r\n@doolse "}}
{"actor":{"display_login":"omefire"}}