Setting keyDownEvents to undefined throws native exception
Environment
react-native-cli: 2.0.1
react-native: 0.60.6
System:
OS: Windows 10 10.0.18363
CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz
Memory: 24.29 GB / 47.92 GB
Binaries:
Node: 10.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.17.3 - C:\Users\aschultz\AppData\Roaming\npm\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.6 => 0.60.6
react-native-windows: 0.60.0-vnext.91 => 0.60.0-vnext.91
rnpm-plugin-windows: 0.3.5 => 0.3.5
Installed UWP SDKs:
10.0.10240.0
10.0.10586.0
10.0.14393.0
10.0.15063.0
10.0.16299.0
10.0.17134.0
10.0.17744.0
10.0.17763.0
10.0.18362.0
Target Platform Version: 10.0.18362.0
Target Devices: Desktop
Visual Studio: 2017
Config: Debug
Steps to Reproduce
render() {
return <View keyDownEvents={undefined} />
}
Expected Behavior
KeyboardEventHandler.cpp clears list of keys to mark as handled.
Actual Behavior
KeyboardEventHandler.cpp throws exception in KeyboardHelper::FromJS
Additional context
KeyboardHelper::FromJS should be changed to return an empty vector if the incoming property value is undefined.
std::vector<HandledKeyboardEvent> KeyboardHelper::FromJS(folly::dynamic const &obj) {
if (obj.isNull()) {
return std::vector<HandledKeyboardEvent>{};
}
return json_type_traits<std::vector<HandledKeyboardEvent>>::parseJson(obj);
}
@aschultz we'd be happy to take your fix above. Can you help us out and create a PR?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 14 days of this comment.
Re-opening to make sure this issue is still tracked. When this is hit in an app it's a bit challenging to track down what's wrong.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 14 days of this comment.