purescript-react-basic-native icon indicating copy to clipboard operation
purescript-react-basic-native copied to clipboard

Handling both react and react native in a generic way?

Open frasermince opened this issue 6 years ago • 4 comments

Hey! This is more of a question than an issue, but this is the best place I could find to ask it. I found this comment discussing a dsl you wrote with purescript-run to write an app that works with the browser and react-native. Are there any examples of this? How would I go about using such a thing? Was there a significant performance hit to writing an app in this way? Feel free to close if this is the wrong place to talk about this but I was just really curious. Thanks!

frasermince avatar Oct 28 '19 19:10 frasermince

Hey, I'm just about to begin a rewrite of that DSL. The first step is understanding purescript-run. I'll put together an outline of how it works over the next hour or so since it's basically what I'm doing right now anyway. I'll comment back here when I've got something to show

dwhitney avatar Oct 28 '19 20:10 dwhitney

Alright I've got to head home, but here's a working example: https://github.com/dwhitney/components-example

I still have to add all of the crap to get a react native app going (by that I mean the stuff that create-react-native-app installs), which I'll do later this evening. But otherwise everything from the PureScript side is in place!

Please ask me questions! I'm about to start dog-fooding this React Native library now, so I'd like feedback if you've got it.

dwhitney avatar Oct 28 '19 22:10 dwhitney

This is really cool! I could see this working well with something like Material ui. What has the performance of apps built with this looked like? I know both free (and I assume by extension run) and purescript will add overhead. Does it make the apps prohibitively large? Also an unrelated question, if I wanted to use the animated react native api, is this currently part of the existing codegen of purescript-react-basic-native? If not is there a simple way to extend it to include that?

frasermince avatar Oct 28 '19 22:10 frasermince

The overhead is negligible . I think Free gets a bad rap. If you run into a performance issue somewhere you can just move the abastraction up higher and provide an implementation that is more tuned for your needs, but all-in-all you're probably looking at less than 5ms additional time to render your app. And I think that's an overestimate, but I've never felt the need to do any benchmarks.

I've never used the Animation API. It's different than the rest of the API, so it would take a bit of effort to get it working. That said you could easily get it working with FFI

On Mon, Oct 28, 2019, 6:46 PM Fraser Mince [email protected] wrote:

This is really cool! I could see this working well with something like Material ui. What has the performance of apps built with this looked like? I know both free (and I assume by extension run) and purescript will add overhead. Does it make the apps prohibitively large? Also an unrelated question, if I wanted to use the animated react native api, is this currently part of the existing codegen of purescript-react-basic-native? If not is there a simple way to extend it to include that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dwhitney/purescript-react-basic-native/issues/15?email_source=notifications&email_token=AAAIFIPQYLP5GMJBO4MHWYLQQ5TVTA5CNFSM4JF7ETH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECOUQZA#issuecomment-547178596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIFIPTXGXLQQK36D64OADQQ5TVTANCNFSM4JF7ETHQ .

dwhitney avatar Oct 28 '19 23:10 dwhitney