Passing forwardedRef to Slider

Reviewed By: sahrens

Differential Revision: D8345883

fbshipit-source-id: d2affdba14d38593541e591fe72006c76fca166f
This commit is contained in:
Eli White 2018-06-10 14:17:13 -07:00 committed by Facebook Github Bot
parent 160bf731e5
commit f50ce0850d
1 changed files with 4 additions and 7 deletions

View File

@ -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,