Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawer content color keep dark #2312

Closed
EasonWang01 opened this issue Sep 28, 2018 · 9 comments
Closed

Drawer content color keep dark #2312

EasonWang01 opened this issue Sep 28, 2018 · 9 comments
Assignees

Comments

@EasonWang01
Copy link

import React from 'react';
import { Container, Drawer, Button, Icon, Content, Text } from 'native-base';

export default class App extends React.Component {
  static navigationOptions = {
    header: null,
  };
  closeDrawer = () => {
    this.drawer._root.close()
  };
  openDrawer = () => {
    this.drawer._root.open()
  };

  render() {
    return (
      <Drawer
        ref={(ref) => { this.drawer = ref; }}
        content={<Content style={{ backgroundColor: '#FFFFFF' }}>
          <Text>Drawer</Text>
        </Content>}>
              <Button onPress={() => this.openDrawer()} transparent>
              <Icon name='menu' />
            </Button>
      </Drawer>
    )
  }
}

screen shot 2018-09-28 at 4 47 46 pm

Expect result: Drawer content is light and white color.

@ali-shariati-990
Copy link

exact same issue here! any answer please...

@andreslopezdreams
Copy link

I still have the same problem, try zIndex and it does not work either, the only thing I could change is the type to displace

<Drawer type="displace" ...

Node: 8.12.0
Mac OS: Mojave
react-native: 0.57.1
native-base: ^2.8.0

@ilkka-yli
Copy link

Same issue here!

native-base: ^2.8.0,
react-native: 0.57.1

@MariaFF
Copy link

MariaFF commented Oct 2, 2018

The same issue here :/
react-native: 0.57.0,
native-base: 2.8.0

@alextrevisan
Copy link

Same isse here.
react-native: 0.57.0,
native-base: "^2.8.0

@grean
Copy link

grean commented Oct 3, 2018

Same as well
react-native: 0.57.1,
native-base: "^2.8.1

@suishum
Copy link

suishum commented Oct 5, 2018

Managed to fix this issue by digging into the default properties of the Drawer component, by default the Drawer component's overlay has an elevation property of 8.

The elevation prop only effects Android (which is why this problem is not present in iOS) - to change the default props you can do this:

import { Drawer } from 'native-base';
...
Drawer.defaultProps.styles.mainOverlay.elevation = 0;

or wait until the above PR is merged (:

@jimcullenaus
Copy link

@suishum when I try that workaround I get:

You attempted to set the key `elevation` with the value `0` on an object that is meant to be immutable and has been frozen.

throwOnImmutableMutation
`deepFreezeAndThrowOnMutationInDev.js:71:4

etc.

My editor also underlines defaultProps in red, saying "Property 'defaultProps' does not exist on type 'typeof Drawer'." (But then, it also says property _root doesn't exist on drawer, and yet my open and close methods work just fine, so that's easy enough to ignore.)

However, adding styles={{mainOverlay: 0}} to the Drawer's props worked just fine.

@hesham-abboud
Copy link

hesham-abboud commented Jan 11, 2019

@suishum when I try that workaround I get:

You attempted to set the key elevation with the value 0 on an object that is meant to be immutable and has been frozen.

throwOnImmutableMutation
`deepFreezeAndThrowOnMutationInDev.js:71:4

etc.

My editor also underlines defaultProps in red, saying "Property 'defaultProps' does not exist on type 'typeof Drawer'." (But then, it also says property _root doesn't exist on drawer, and yet my open and close methods work just fine, so that's easy enough to ignore.)

However, adding styles={{mainOverlay: 0}} to the Drawer's props worked just fine.

@jimcullenaus The error u mentioned appeared to me second time the view was rendered.
adding below code fixed the problem

if (Drawer.defaultProps.styles.mainOverlay.elevation != 0)
Drawer.defaultProps.styles.mainOverlay.elevation = 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests