Warning: Function components cannot be given refs.
I use SwipeListView and get this error message: Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
I am rendering a function component in row and this message receive only if my row isn't swipeable (or if renderHiddenItem return null).
From my perspective it happens because of row 179 of components/SwipeListView.js module of this repo.
I am able to fix this only if I return some component from renderHiddenItem instead of null for current row. But this enabled swipe gesture at the same time...
- iOS and Android platform
- RNSLV Version: 3.2.6
- RN Version: 0.63.4
same issue, same reason
For me as well.
@sulaigor (and everyone) sorry this completely fell off my radar! I'm trying to address this but I don't see the error message. Can someone please post a reproducible example and I'll get on a fix. Thanks!
I am getting this error when I give the swipe-list a ref so that I can use scrollToIndex for scroll to top I'm not sure how to fix it. The solutions I see involve refs for functional components like this
`` const FuncComponent = ({ forwardRef }) => { const [text, setText] = useState('functional component');
forwardRef((text) => renderText(text));
function renderText(text) { setText(text); }
return (
But I simply want to be able to do
<SwipeListView ref={listRef} />
Hi @The-Pr0grammer I think you're looking for the prop listViewRef, see more here https://github.com/jemise111/react-native-swipe-list-view/blob/master/docs/SwipeListView.md
Hi @The-Pr0grammer I think you're looking for the prop
listViewRef, see more here https://github.com/jemise111/react-native-swipe-list-view/blob/master/docs/SwipeListView.md
ofc thank you