Files
react-native/ReactCommon/fabric/components/slider/SliderEventEmitter.cpp
Joshua Gross c40a782b3a Fabric: Add Fabric-compatible Slider component to iOS
Summary: Fabric-compatible Slider component, minus image support (coming soon!)

Reviewed By: shergin

Differential Revision: D13644717

fbshipit-source-id: ce3f0c1ee530be4807b875cb2080c59693b7337a
2019-01-22 17:03:08 -08:00

31 lines
804 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 "SliderEventEmitter.h"
namespace facebook {
namespace react {
void SliderEventEmitter::onValueChange(float value) const {
dispatchEvent("valueChange", [value](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "value", value);
return payload;
});
}
void SliderEventEmitter::onSlidingComplete(float value) const {
dispatchEvent("slidingComplete", [value](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "value", value);
return payload;
});
}
} // namespace react
} // namespace facebook