【发布时间】:2021-12-27 04:28:48
【问题描述】:
我目前正在使用“https://www.npmjs.com/package/react-native-raw-bottom-sheet”库处理自下而上面板的 React Native 项目。
我想每次单击父组件中的按钮而不是单击子组件中的按钮时触发自下而上的面板,我该如何实现。
Bottom Up Panel 子组件:
const refRBSheet : any = useRef();
View style={styles.container}>
<View style={{width:200}}>
<Button title="OPEN BOTTOM SHEET" onPress={() => refRBSheet.current.open()} />
</View>
<RBSheet
ref={refRBSheet}
closeOnDragDown={true}
closeOnPressMask={true}
animationType='slide'
customStyles={{
wrapper: {
backgroundColor: "transparent"
},
draggableIcon: {
backgroundColor: "#999999"
},
container:{
backgroundColor:'#101010',
height:450,
}
}}
>
<MyComponent/>
</RBSheet>
</View>
我的父组件:
<View>
<Button title="I want to click this button and trigger ButtomUpPanel/>
<BottomUpPanel/>
</View>
【问题讨论】:
标签: android reactjs react-native