Files
react-native/ReactCommon/react/renderer/components/picker/iospicker/PickerEventEmitter.cpp
T
Peter Argany 251d5e1bbe Fabric Picker onChange event
Summary:
Implements `onChange` prop for `<Picker/>`.

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D23975689

fbshipit-source-id: 7aa81c203d420a8971e4309911a41ecfd377a318
2020-10-13 11:19:29 -07:00

24 lines
649 B
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PickerEventEmitter.h"
namespace facebook {
namespace react {
void PickerEventEmitter::onChange(PickerIOSChangeEvent event) const {
dispatchEvent("change", [event = std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "newValue", event.newValue);
payload.setProperty(runtime, "newIndex", event.newIndex);
return payload;
});
}
} // namespace react
} // namespace facebook