root-two / react-native-drawer

React Native Drawer
MIT License
2.54k stars 392 forks source link

Open drawer shadow #363

Open MSSPL-PiyaleeMaiti opened 6 years ago

MSSPL-PiyaleeMaiti commented 6 years ago

I use the below style for shadow when I open the drawer.

const drawerStyles = {
      drawer: { shadowColor: '#000000', shadowOpacity: 0.1, shadowRadius: 3},
      main  : {paddingLeft : 0, backgroundColor:'#000000'},
    };
<Drawer
          type               = "static"
          content            = {<DrawerContent />}
          styles             = {drawerStyles}
          tapToClose         = {true}
          openDrawerOffset   = {0.15} // 15% gap on the right side of drawer
          panCloseMask       = {0.2}
          closedDrawerOffset = {0}
          tweenDuration      = {500}
          tweenEasing        = "easeInOutQuad"
          initializeOpen     = {false}
          ref                = {(ref) => this._drawer = ref}
          tweenHandler       = {Drawer.tweenPresets.parallax}
          onOpen             = {() => this._onOpenDrawer()}
          onClose            = {() => {}}>
          <MainContent />
    </Drawer>

But it's not working on android and ios both platform. Can anyone suggest any solution for shadow implementation? I want the shadow when I open the drawer then the main content will be shown in shadow. When drawer close the shadow will be gone.

Carlosarturo28 commented 6 years ago

For Android use elevation={2} As said in the Docs:

elevation (Number) 0 - (Android-only) Sets the elevation of the drawer using Android's underlying elevation API