11import React , { useState , Fragment } from 'react' ;
22import { View , Text } from 'react-native' ;
3- import { Button , Drawer , Spacing , WingBlank } from '@uiw/react-native' ;
3+ import { RootSiblingPortal } from 'react-native-root-siblings' ;
4+ import { Button , Drawer , Spacing , WingBlank , Input } from '@uiw/react-native' ;
45import Layout , { Container } from '../../Layout' ;
56import { ComProps } from '../../routes' ;
67const { Header, Body, Footer} = Layout ;
@@ -14,42 +15,66 @@ export default function DrawerView({route}: DrawerViewProps) {
1415 const [ visible2 , setVisible2 ] = useState ( false ) ;
1516 const [ visible3 , setVisible3 ] = useState ( false ) ;
1617 const [ visible4 , setVisible4 ] = useState ( false ) ;
18+ const [ value , setValue ] = useState ( '' ) ;
19+
1720 return (
1821 < Fragment >
19- < Drawer isOpen = { visible2 } placement = "right" onChange = { ( isOpen : boolean ) => setVisible2 ( isOpen ) } drawerBackgroundColor = "red" >
20- < View >
21- < Text style = { { color : '#ccc' } } > 右边打开抽屉内容</ Text >
22- </ View >
23- </ Drawer >
2422 < Drawer
2523 isOpen = { visible }
24+ drawerBackgroundColor = "red"
2625 onChange = { ( isOpen : boolean ) => {
2726 setVisible ( isOpen ) ;
2827 } } >
2928 < View >
3029 < Text style = { { color : '#ccc' } } > 左边打开抽屉内容</ Text >
3130 </ View >
3231 </ Drawer >
33- < Drawer
34- isOpen = { visible3 }
35- placement = "top"
36- onChange = { ( isOpen : boolean ) => {
37- setVisible3 ( isOpen ) ;
38- } } >
39- < View >
40- < Text style = { { color : '#ccc' } } > 上边打开抽屉内容</ Text >
41- </ View >
42- </ Drawer >
32+
33+ < RootSiblingPortal >
34+ < Drawer
35+ drawerWidth = { 200 }
36+ drawerHeight = { 200 }
37+ isOpen = { visible2 }
38+ placement = "right"
39+ onChange = { ( isOpen : boolean ) => setVisible2 ( isOpen ) }
40+ drawerBackgroundColor = "red" >
41+ < View >
42+ < Input
43+ onChangeText = { ( value : string ) => {
44+ setValue ( value ) ;
45+ } }
46+ value = { value }
47+ />
48+ < Text style = { { color : '#ccc' } } > 右边打开抽屉内容</ Text >
49+ </ View >
50+ </ Drawer >
51+ </ RootSiblingPortal >
52+
53+ < RootSiblingPortal >
54+ < Drawer
55+ isOpen = { visible3 }
56+ placement = "top"
57+ drawerBackgroundColor = "red"
58+ onChange = { ( isOpen : boolean ) => {
59+ setVisible3 ( isOpen ) ;
60+ } } >
61+ < View >
62+ < Text style = { { color : '#ccc' } } > 上边打开抽屉内容</ Text >
63+ </ View >
64+ </ Drawer >
65+ </ RootSiblingPortal >
4366 < Drawer
4467 isOpen = { visible4 }
4568 placement = "bottom"
69+ drawerBackgroundColor = "red"
4670 onChange = { isOpen => {
4771 setVisible4 ( isOpen ) ;
4872 } } >
4973 < View >
5074 < Text style = { { color : '#ccc' } } > 下边打开抽屉内容</ Text >
5175 </ View >
5276 </ Drawer >
77+
5378 < Container >
5479 < Layout >
5580 < Header title = { title } description = { description } />
0 commit comments