mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-15 21:21:44 +08:00
Summary: Fabric-compatible Slider component, minus image support (coming soon!) Reviewed By: shergin Differential Revision: D13644717 fbshipit-source-id: ce3f0c1ee530be4807b875cb2080c59693b7337a
31 lines
804 B
C++
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
|