New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref prop is not working for Button component of New React native element lib (@rneui/base & @rneui/themed) #3885
Comments
Hey, the example code you provided needs to be wrapped in const Button = forwardRef((props,ref) => {
const { containerStyle, theme, ...rest } = props;
const buttonStyles = styles(containerStyle);
const fetchedStyle = buttonColors(props);
const { titleStyle, icon, ...buttonStyle } = fetchedStyle;
return <LibraryButton ref={ref} icon={icon} {...rest} {...buttonStyles} buttonStyle={buttonStyle} titleStyle={titleStyle} />;
});
export default withTheme(Button); |
@arpitBhalla Thanks for reply but We have already tried this solution but it did not work. It is working fine if We are importing Button Component from 'react-native'. It is not working if We are importing Button component from '@rneui/base'. Kindly help on it. |
Is there an existing issue for this?
Explain what you did
ref prop is not working for Button component
`
import { withTheme } from '@rneui/themed';
import { Button as LibraryButton } from '@rneui/base';
..........
const Button = (props) => {
const { containerStyle, theme, ...rest } = props;
const buttonStyles = styles(containerStyle);
const fetchedStyle = buttonColors(props);
const { titleStyle, icon, ...buttonStyle } = fetchedStyle;
return <LibraryButton icon={icon} {...rest} {...buttonStyles} buttonStyle={buttonStyle} titleStyle={titleStyle} />;
};
....
export default withTheme(Button);
`
we are sending ref as prop in Button Component like below code.
Versions using :
"@rneui/base": "^4.0.0-rc.8",
"@rneui/themed": "^4.0.0-rc.8"
`
const submitButtonRef = React.useRef();
........
`
Expected behavior
Currently Getting: we are getting undefined for submitButtonRef?.current
Expected: we should get submitButtonRef?.current value.
Describe the bug
ref prop is not working for Button component
Steps To Reproduce
Screenshots
No response
Your Environment
`npx @rneui/envinfo`
The text was updated successfully, but these errors were encountered: