mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Simplify logic to coerce DisplayMode
Summary: Changelog: [Internal] TSIA Reviewed By: ShikaSD Differential Revision: D28061403 fbshipit-source-id: bb98fa2ccdd3f8e936bec95fbbbeace42664a608
This commit is contained in:
1 parent
6386f691f7
commit
fdfadd43f2
1 file changed
+4
-5
@@ -19,15 +19,14 @@ const DisplayMode: {[string]: DisplayModeType} = Object.freeze({
|
||||
});
|
||||
|
||||
export function coerceDisplayMode(value: ?number): DisplayModeType {
|
||||
if (value == null || value === undefined) {
|
||||
return DisplayMode.VISIBLE;
|
||||
}
|
||||
switch (value) {
|
||||
case DisplayMode.SUSPENDED:
|
||||
return DisplayMode.SUSPENDED;
|
||||
case DisplayMode.HIDDEN:
|
||||
return value;
|
||||
return DisplayMode.HIDDEN;
|
||||
default:
|
||||
return DisplayMode.VISIBLE;
|
||||
}
|
||||
return DisplayMode.VISIBLE;
|
||||
}
|
||||
|
||||
export default DisplayMode;
|
||||
Reference in new issue
Block a user