mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add default case to facebook::react::displayModeToInt() (#48711)
Summary: In the `displayModeToInt()` function, there is no default case defined which is causing the following warning in React Native Windows when trying to build on the New Architecture: ``` ##[error]node_modules\react-native\ReactCommon\react\renderer\uimanager\primitives.h(163,1): Error C2220: the following warning is treated as an error D:\a\_work\1\s\node_modules\react-native\ReactCommon\react\renderer\uimanager\primitives.h(163,1): error C2220: the following warning is treated as an error [D:\a\_work\1\s\vnext\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj] ##[warning]node_modules\react-native\ReactCommon\react\renderer\uimanager\primitives.h(163,1): Warning C4715: 'facebook::react::displayModeToInt': not all control paths return a value D:\a\_work\1\s\node_modules\react-native\ReactCommon\react\renderer\uimanager\primitives.h(163,1): warning C4715: 'facebook::react::displayModeToInt': not all control paths return a value [D:\a\_work\1\s\vnext\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj] ``` Adding the default case removes the warning and resolves the issue. Not sure if using the -1 value in this case is appropriate. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Fixed] - Add default case to `displayModeToInt()` function Pull Request resolved: https://github.com/facebook/react-native/pull/48711 Test Plan: Tested on React Native Windows New Arch application and was able to build successfully. Reviewed By: javache Differential Revision: D68265335 Pulled By: rshest fbshipit-source-id: 4724a4c7391b9bf651a122f5de227a0c5e0b6212
This commit is contained in:
committed by
Facebook GitHub Bot
parent
eced906bed
commit
8c06f57860
@@ -159,6 +159,9 @@ inline static int displayModeToInt(const DisplayMode value) {
|
||||
return 2;
|
||||
case DisplayMode::Hidden:
|
||||
return 3;
|
||||
default:
|
||||
react_native_assert(0 && "displayModeToInt: Invalid DisplayMode");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user