Live data from Hacker News

React Native for Windows and Mac

microsoft.github.io

411–420 of 505 posts

Re: React Native for Windows and Mac

#411
post #351

Earlier quoted context omitted.

> Dart still has all types nullable by default TypeScript is even worse in that regard since it has to deal with JS that wasn't written in TypeScript & there's no way to verify the runtime object complies with the interface you say it does. Then of course JS has to deal with multiple null & undefined values & even more falsy values, ultimately TypeScript provides nice static analysis but also a false sense of securit…

I have never encountered issues with JS libraries lying in their type definitions (like not including `T|undefined` in the type if `undefined` is a possible return value). More often this can happen with external data (typing incoming JSON responses), but you have to run-time validate those anyway. `null` is only rarely used in JS, `undefined` is by far the more common one, and of course the types reflect which one i…

> `null` is only rarely used in JS, `undefined` is by far the more common one, and of course the types reflect which one is a possible value, so it's not like you can miss it by accident.

That's not true, `undefined` is not even a keyword or type, `null` is what you would use if you wanted to specify a variable has "no value" in JS or JSON (again because `undefined` isn't a Type). The "undefined" value is only for specifying if the variable "does not exist". The difference is important as the behavior is different depending on how you use them.

> I just always use the full form with the `===` operator, e.g. `if (variable !== undefined)` instead of `if (variable)`

This is bad practice as you're only testing for `undefined` here, not `null`, this is basically the only time where strict equality isn't useful. You want to test with `if (variable != null)` which tests for both `null` and `undefined` and not other falsy values that `if (variable)` tests for.

> There is now also the `??` operator

Right, the Nullish coalescing operator (which Dart/C# also has) tests for both `null` and `undefined` (well `void 0` since the `undefined` value can be overridden) and not falsy values.

Re: React Native for Windows and Mac

#412
post #17

React Native scares me with its dependency webs: http://npm.anvaka.com/#/view/2d/react-native From my experience, it's really great to work with and definitely saves a ton of work, but the depgraph above fills me with doubt for use in sensitive applications such as in finance or healthcare. For this reason, I've been trying out Flutter or even considering to go back to native apps. Perhaps there's some kind of middle…

A lot of these "packages" are just silly though. Among the horde of dependencies in that web is `number-is-nan`. Behold its awesome functionality:

https://www.npmjs.com/package/number-is-nan

Want Array#filter/map/reduce? Why that'll be three separate packages:

https://www.npmjs.com/package/array-filter https://www.npmjs.com/package/array-map https://www.npmjs.com/package/array-reduce

It just seems to be the culture of the Node.js crowd to take a library, break it up into functions, and publish every. single. one. as a separate package.

Re: React Native for Windows and Mac

#413
post #122

Earlier quoted context omitted.

It was the worst experience of my development life, building a phone app with it........................ never, never, never again. If you want to know what it's like to have everything break LITERALLY every few days, use react native.

There were breaks for sure, but I worked in a shared-codebase web/native app using RN and React, and it was overall pretty pleasant. How early were you using it? It was actually pretty reliable.

Same experience with me. My company launched their RN app on iOS and Android and it was pretty successful and pleasant.

Re: React Native for Windows and Mac

#414
post #396

While personally I dislike React Native in the strongest terms possible for the number of nigh impossible to debug technical issues it has brought the projects that tried to tame it, there is a really interesting moment happening here. Microsoft is embracing Facebook's cross-platform tools to eventually compete with Google's cross-platform Electron. Microsoft currently relies on Google for the internals of VS Code, G…

V8, Chromium and Blink are an Open Source projects that Google is one of the main contributors to, but they're not 'Google'. If Google went away tomorrow, V8, Chromium and Blink would still exist, and Microsoft would be able to use all projects.

Sure they are open source projects, but the majority of dev work is done on Google's dime. Google employs many of the most important people in these projects. Sure the code will still be there if Google gives up, but will anyone have the capacity to step up and maintain them?

Re: React Native for Windows and Mac

#415
post #5

Flutter seems to be gaining ground on React Native. And they also have web and desktop ports. Recently flutter overtook react native on Google trends.

Flutter on the web is absolutely insane. For those who don't know, it basically strips away everything and wraps it in a big terrifyingly complex mess of code and renders everything in a canvas. Flutter advocates like to claim that that's "only a fallback" for when things get complex but as far as I can tell the vast majority of things (including the simplest examples from Flutter itself) force the entire thing into…

Goodbye accessibility.

Re: React Native for Windows and Mac

#416
post #390

Earlier quoted context omitted.

Am I the only one who just spent 5 minutes chasing moving nodes round in that graph looking for leftpad.js?

Why don't people copy the deb-tree to their local repo and/or pin the version that they want, so that they can be free of node terrorists? EDIT: To be clear - maybe I am REALLY old-school, but every time we did a release, we archived our tool-chain (GCC blah blah, Make blah blah, bash blah blah), our depencies, our vendor libraries and our code, so that IF in 20 years, if we had to rebuild a particular release (12.x)…

This makes sense if you're releasing versioned software builds to 3rd parties. If you're running it internally (e.g. as a SaaS company) then there's much less cause to run an old versions, let alone one from 20 years ago.

Re: React Native for Windows and Mac

#417
post #368
post #92

Earlier quoted context omitted.

> RN isn't even native, it still includes a Javascript bridge "Native" doesn't describe the programming language, but the GUI layer. Native == non-web-browser.

The GUI layer in a static sense. You can't have native realtime interactions with the GUI, for instance dragging and interactive animations. You can choose one of two things: 1) Run a single precomputed action or animation in native-land when receiving an event from JS. No interaction is possible. 2) Run a requestAnimationFrame loop in JS which is passing the bridge (6 API calls on Android - 3 layers per direction) 6…

Have you tried react-native-reanimated?

Re: React Native for Windows and Mac

#418
post #411

Earlier quoted context omitted.

I have never encountered issues with JS libraries lying in their type definitions (like not including `T|undefined` in the type if `undefined` is a possible return value). More often this can happen with external data (typing incoming JSON responses), but you have to run-time validate those anyway. `null` is only rarely used in JS, `undefined` is by far the more common one, and of course the types reflect which one i…

> `null` is only rarely used in JS, `undefined` is by far the more common one, and of course the types reflect which one is a possible value, so it's not like you can miss it by accident. That's not true, `undefined` is not even a keyword or type, `null` is what you would use if you wanted to specify a variable has "no value" in JS or JSON (again because `undefined` isn't a Type). The "undefined" value is only for sp…

Regarding the `if`, it only makes sense to test for things that the type actually contains.

So if I have a type `User|undefined`, testing `if (user === undefined || user === null)` is pointless, as `null` is not part of that type. It would be different if it were. Similarly, it makes no sense to test a variable of `User` type for value `false`, like it would if the type were `User|boolean`, or even `User|false` which you can do in TypeScript (not that you should). So `if (variable)` is still bad (ok for booleans, tolerable for some types but better avoided). You only test for what the variable can contain.

Some types you encounter are `T|null` - mostly DOM things (e.g. the return value of getElementById), but some JSON stuff as well like you said. Even though a lot of JSON just has optional properties instead, which for all intents and purposes work like `|undefined` when reading them.

From my experience, it is much more common to deal with `undefined` in the JS ecosystem, whether that is by omitting properties from objects, or explicitly assigning/returning `undefined` somewhere.

`T|null|undefined` types are ever rarer. Only for those it makes sense to test for both null and undefined.

By the way you can also have types like

    type RemoteData = {ready: false} | {ready: true, data: T}
in TypeScript, which is better than

    { ready: boolean, data?: T }
because you don't have to worry about "does `data` still make sense when it is non-ready?", the type clearly tells you that it doesn't (of course you can also have a different type where it would, the point is to accurately describe the structures you deal with). Then, if you do a check

    if (remote.ready) {
        console.log(remote.data.length)
    }
it knows that data exists inside that `if` block, so you can safely access it without `!` or `?`. Similarly, inside `if (!remote.ready) { }`, you cannot access it at all. It also won't let you pass an object with { ready: true }, but no data of the required type to `RemoteData`.

Re: React Native for Windows and Mac

#419
post #390

Earlier quoted context omitted.

Why don't people copy the deb-tree to their local repo and/or pin the version that they want, so that they can be free of node terrorists? EDIT: To be clear - maybe I am REALLY old-school, but every time we did a release, we archived our tool-chain (GCC blah blah, Make blah blah, bash blah blah), our depencies, our vendor libraries and our code, so that IF in 20 years, if we had to rebuild a particular release (12.x)…

This makes sense if you're releasing versioned software builds to 3rd parties. If you're running it internally (e.g. as a SaaS company) then there's much less cause to run an old versions, let alone one from 20 years ago.

Yeah. I get that. Getting enterprise people to migrate or go off-prem for everything takes some time. And some like custom versons! I just like to snap-shot everything (including the tool chain) so that I can recreate the past out of my repository at any time for any reason. (I'm weird like that - I expect the same out of legal, ops and accounting as well)

Maybe I'm old - but I don't trust Quickbooks-in-the-Cloud.

EDIT: But I use 'em!

Re: React Native for Windows and Mac

#420
post #385

Looked at it a while ago when I was trying to start a cross-platform app (both on mobile and on desktop), but under the Mac section it simply said "Coming Soon!". I thought there's some update with this post receiving so many upvotes, but apparently it's still the same, and Mac support is still in a very early experimental stage. Flutter left me a similar impression. I eventually ended up using Quasar https://quasar.…

I think I might be on the same boat. I have personally looked into all frameworks and planning to hire a team, quasar seems is one of the options. The application isn't for any mission-critical application, revolves around curd. Quasar is a good option albeit with a lot of baggage, Flutter is clean but for Desktop use case it's still evolving. How was your experience with Quasar? Would you recommend Flutter over Quasar?
Post reply on HN