In my React Native app, I'm using the library, react-native-card-flip.
In the class component, I use it as follows:
<CardFlip style={styles.cardContainer} ref={(card) => this.card = card} >
<TouchableOpacity style={styles.card} onPress={() => this.card.jiggle({ count: 2, duration: 100, progress: 0.05 })} ><Text>AB</Text></TouchableOpacity>
<TouchableOpacity style={styles.card} onPress={() => this.card.flip()} ><Text>CD</Text></TouchableOpacity>
</CardFlip>
However, if I put the same thing in a functional component, I get an error about the 'ref'.
Undefined is not an object. Evaluating _this.card = card.
Something wrong with ref in the functional component. How can I correct this? Can you please help?
useRefreactjs.org/docs/hooks-reference.html#useref