oblador / react-native-collapsible

Animated collapsible component for React Native, good for accordions, toggles etc
MIT License
2.43k stars 453 forks source link

ReactNativeFiberHostComponent: Calling `getNode()` on the ref of an Animated component is no longer necessary. #356

Open mrusmanali opened 4 years ago

mrusmanali commented 4 years ago

ReactNativeFiberHostComponent: Calling getNode() on the ref of an Animated component is no longer necessary. You can now directly use the ref instead. This method will be removed in a future release.

The code is working fine I am but getting this warning. Here is my implementation.

` import React, {useState} from 'react'; import { Image, View, Text, TouchableOpacity } from 'react-native'; import Accordion from 'react-native-collapsible/Accordion';

import styles from './styles';

export default () => { const [active, setActive] = useState([0]) const SECTIONS = ['1','1','1','1','1','1','1'];

const renderHeader = (section, _, isActive) => {
    return (
        <View><Text>Header</Text></View>
    )
}
const renderContent = (section, _, isActive) => {
    return (
        <View><Text>Content</Text></View>
    )
}
const updateSections = section => {
    setActive(section)
}

return ( <Accordion activeSections={active} sections={SECTIONS} touchableComponent={(props) => <TouchableOpacity {...props} />} renderHeader={renderHeader} renderContent={renderContent} onChange={updateSections} /> ) } `

abdulLatif-dev commented 4 years ago

Same problem +1

noumansakhawat-dev commented 4 years ago

goto node module -> react-native-collapsible -> collapisble.js on line# 88 replace this.contentHandle.getNode().measure((x, y, width, height) => {

with

let ref; if (typeof this.contentHandle.measure === 'function') { ref = this.contentHandle; } else { ref = this.contentHandle.getNode(); } ref.measure((x, y, width, height) => {

A pull request is also created! :)

dmantelli commented 4 years ago

Same problem ! +1

jbromberg commented 4 years ago

Same issue. Fixed with code above.

outaTiME commented 4 years ago

Yup, same here guys after update to RN 62