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

Why viewport have two height ? #354

Open
dev4xy opened this issue May 18, 2018 · 0 comments
Open

Why viewport have two height ? #354

dev4xy opened this issue May 18, 2018 · 0 comments

Comments

@dev4xy
Copy link

dev4xy commented May 18, 2018

Since I used Drawer, my page height changes twice

See footer on load :

drawer

In fact, we have two viewport.height

I understood this through:

openDrawerOffset={(viewport) => {
    alert(viewport.height)
    return 100
}}

The alert is displayed twice with a different height.

--

My example code (above gif):

render() {
  let mainMenu = <MainMenu closeDrawer={() => {
    this.drawer.close();
  }}/>;
  return (
    <Drawer
      ref={c => this.drawer = c}
      type={'static'}
      openDrawerOffset={100}
      panOpenMask={.1}
      panCloseMask={0}
      panThreshold={.25}
      content={mainMenu}
      styles={drawerStyles}
      tweenDuration={150}
      acceptTap={true}
      acceptPan={true}
      tapToClose={true}
      negotiatePan={true}
      side={'left'}
    >
      <View style={styles.container}>
        <View style={{height: 56, backgroundColor: '#ff2663'}}><Text>Header</Text></View>
        <View style={{flex: 1, backgroundColor: '#0023ff'}}><Text>Content</Text></View>
        <View style={{height: 40, backgroundColor: '#ffeb00'}}><Text>Footer</Text></View>
      </View>
    </Drawer>
  );
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#EEEEEE',
  },
});

const drawerStyles = {
  drawer: {},
  main: {shadowColor: '#000000', shadowOpacity: 0.8, shadowRadius: 3, elevation: 16}
};

Please help me. thanks.

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

1 participant