mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
251d5e1bbe
Summary: Implements `onChange` prop for `<Picker/>`. Changelog: [iOS][Fabric] Fabric Picker support Reviewed By: sammy-SC Differential Revision: D23975689 fbshipit-source-id: 7aa81c203d420a8971e4309911a41ecfd377a318
24 lines
649 B
C++
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
|