Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React native typeScript and forwardRef in a functional component

$
0
0

I'm in react native app an I use typeScript too.I have a functional component :

const Input: React.FunctionComponent<IInputProps> = ({  inputStyle,  placeHolderColor = EAppColors.DARK_GREY,  placeHolder,  value,  onChangeText,  autoFocus,  onFocus,  onBlur,  onSubmitEditing,  ref,  keyboardType = EKeyboardType.DEFAULT,}) => {  return (<StyledInput      testID="TextInputID"      placeholderTextColor={placeHolderColor}      placeholder={placeHolder}    ...  

And I would like to know how i can also use a forwardRef too? (like that for exemple)

const FancyButton = React.forwardRef((props, ref) => (<button ref={ref} className="FancyButton">    {props.children}</button>

Thank You!


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>