Passing forwardedRef to Slider
Reviewed By: sahrens Differential Revision: D8345883 fbshipit-source-id: d2affdba14d38593541e591fe72006c76fca166f
This commit is contained in:
parent
160bf731e5
commit
f50ce0850d
|
@ -194,10 +194,8 @@ type Props = $ReadOnly<{|
|
|||
*
|
||||
*/
|
||||
const Slider = (
|
||||
props: $ReadOnly<{|
|
||||
...Props,
|
||||
forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>,
|
||||
|}>,
|
||||
props: Props,
|
||||
forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>,
|
||||
) => {
|
||||
const style = StyleSheet.compose(
|
||||
styles.slider,
|
||||
|
@ -230,6 +228,7 @@ const Slider = (
|
|||
return (
|
||||
<RCTSlider
|
||||
{...props}
|
||||
ref={forwardedRef}
|
||||
style={style}
|
||||
onChange={onChange}
|
||||
onSlidingComplete={onSlidingComplete}
|
||||
|
@ -242,9 +241,7 @@ const Slider = (
|
|||
};
|
||||
|
||||
// $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet.
|
||||
const SliderWithRef = React.forwardRef((props: Props, ref) => {
|
||||
return <Slider {...props} forwardedRef={ref} />;
|
||||
});
|
||||
const SliderWithRef = React.forwardRef(Slider);
|
||||
|
||||
SliderWithRef.defaultProps = {
|
||||
disabled: false,
|
||||
|
|
Loading…
Reference in New Issue