React-native-collapsible: ReactNativeFiberHostComponent: Calling `getNode()` on the ref of an Animated component is no longer necessary.

Created on 24 Jun 2020  路  5Comments  路  Source: oblador/react-native-collapsible

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 (
activeSections={active}
sections={SECTIONS}
touchableComponent={(props) => }
renderHeader={renderHeader}
renderContent={renderContent}
onChange={updateSections}
/>
)
}
`

Most helpful comment

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! :)

All 5 comments

Same problem +1

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! :)

Same problem ! +1

Same issue. Fixed with code above.

Yup, same here guys after update to RN 62

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jayellul picture jayellul  路  5Comments

jiyarong picture jiyarong  路  8Comments

SaberRiryi picture SaberRiryi  路  3Comments

Korysam15 picture Korysam15  路  4Comments

vijay-dadhich09 picture vijay-dadhich09  路  8Comments