I tried to use react-native-raw-bottom-sheet as a reusable component. And I created one parent Componet, The problem is When I tries to give the values I got this error.
TypeError: undefined is not an object (evaluating 'refRBSheet.current.open')
parent component
import React from 'react';
import RBSheet from 'react-native-raw-bottom-sheet';
const CustomActionSheet = (props) => {
const { ref, Content, height } = { ...props };
return (
<RBSheet
height={height}
ref={ref}
closeOnDragDown={true}
closeOnPressMask={true}
customStyles={{
wrapper: {
backgroundColor: 'transparent',
},
draggableIcon: {
backgroundColor: '#000',
},
}}
>
{Content}
</RBSheet>
);
};
export default CustomActionSheet;
child component
<View style={styles.chsDlvrBtn}>
<Button title="Choose Delivery" onPress={() => refRBSheet.current.open()} />
</View>
<CustomActionSheet
ref={refRBSheet}
Content={
<View style={styles.view}>
{MONTH_OF_YEAR.map((val) => {
return (
<Chip mode="outlined" onPress={() => {}} style={styles.chp}>
{val}
</Chip>
);
})}
</View>
}
/>
ref hook
const refRBSheet = useRef()
What's going wrong here. Thanks, Advance !!!