-
-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Description
In #771 and #774, I changed Platform.os
from an abstract type to a polymorphic variant.
This allows us to use the more convenient
if Platform.os === #ios {
...
}
instead of
if Platform.os === Platform.ios {
...
}
which is fine.
It also allows us to do
switch Platform.os {
| #ios => ...
| #android => ...
| _ => ...
}
which is problematic as it compiles to something like
var match = ReactNative.Platform.OS;
if (match === "ios") {
...
} else if (match === "android") {
...
} else {
...
}
which will break Metro bundler's inlining (see a previous discussion in #239 for more details about this).
So I am not sure anymore if we should introduce a breaking change that invites people to use a problematic pattern. What do you think @MoOx?
Metadata
Metadata
Assignees
Labels
No labels