Skip to content

Commit

Permalink
fixing top space
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrizzuto committed Oct 15, 2020
1 parent f8eb6e7 commit f468d99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
15 changes: 8 additions & 7 deletions examples/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import {
Animated,
Dimensions,
Expand All @@ -7,16 +7,17 @@ import {
StyleSheet,
TouchableHighlight,
TouchableWithoutFeedback,
View,
View
} from 'react-native';
import {Bar} from './Bar';
import {Close} from './Close';
import { Bar } from './Bar';
import { Close } from './Close';

let NOTCH_PREVENTION = 14;
let TOP_EXTRA_SPACE = 100 + NOTCH_PREVENTION;

let FULL_HEIGHT = Dimensions.get('window').height - NOTCH_PREVENTION;
let FULL_WIDTH = Dimensions.get('window').width;
let PANEL_HEIGHT = FULL_HEIGHT - NOTCH_PREVENTION;
let PANEL_HEIGHT = FULL_HEIGHT - TOP_EXTRA_SPACE;

const STATUS = {
CLOSED: 0,
Expand Down Expand Up @@ -150,7 +151,7 @@ class SwipeablePanel extends Component<
const dimesions = Dimensions.get('screen');
FULL_HEIGHT = dimesions.height;
FULL_WIDTH = dimesions.width;
PANEL_HEIGHT = FULL_HEIGHT - 100;
PANEL_HEIGHT = FULL_HEIGHT - TOP_EXTRA_SPACE;

this.setState({
orientation:
Expand Down Expand Up @@ -324,7 +325,7 @@ const SwipeablePanelStyles = StyleSheet.create({
position: 'absolute',
height: PANEL_HEIGHT,
width: FULL_WIDTH - 50,
transform: [{translateY: FULL_HEIGHT - 100}],
transform: [{translateY: FULL_HEIGHT - TOP_EXTRA_SPACE}],
display: 'flex',
flexDirection: 'column',
backgroundColor: 'white',
Expand Down
9 changes: 5 additions & 4 deletions src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import {
StyleSheet,
TouchableHighlight,
TouchableWithoutFeedback,
View,
View
} from 'react-native';
import { Bar } from './Bar';
import { Close } from './Close';

let NOTCH_PREVENTION = 14;
let TOP_EXTRA_SPACE = 100 + NOTCH_PREVENTION;

let FULL_HEIGHT = Dimensions.get('window').height - NOTCH_PREVENTION;
let FULL_WIDTH = Dimensions.get('window').width;
let PANEL_HEIGHT = FULL_HEIGHT - NOTCH_PREVENTION;
let PANEL_HEIGHT = FULL_HEIGHT - TOP_EXTRA_SPACE;

const STATUS = {
CLOSED: 0,
Expand Down Expand Up @@ -134,7 +135,7 @@ class SwipeablePanel extends React.Component<SwipeablePanelProps, SwipeablePanel
const dimesions = Dimensions.get('screen');
FULL_HEIGHT = dimesions.height;
FULL_WIDTH = dimesions.width;
PANEL_HEIGHT = FULL_HEIGHT - 100;
PANEL_HEIGHT = FULL_HEIGHT - TOP_EXTRA_SPACE;

this.setState({
orientation: dimesions.height >= dimesions.width ? 'portrait' : 'landscape',
Expand Down Expand Up @@ -286,7 +287,7 @@ const SwipeablePanelStyles = StyleSheet.create({
position: 'absolute',
height: PANEL_HEIGHT,
width: FULL_WIDTH - 50,
transform: [{ translateY: FULL_HEIGHT - 100 }],
transform: [{ translateY: FULL_HEIGHT - TOP_EXTRA_SPACE }],
display: 'flex',
flexDirection: 'column',
backgroundColor: 'white',
Expand Down

0 comments on commit f468d99

Please sign in to comment.