Skip to content

Commit 61f6879

Browse files
committed
chore(Modal): fix precision=left|right 时高度丢失
1 parent 8651459 commit 61f6879

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/core/src/Modal/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import React, { useState, useMemo, useRef } from 'react';
2-
import { Animated, StyleSheet, LayoutChangeEvent, View } from 'react-native';
2+
import { Animated, StyleSheet, LayoutChangeEvent, Dimensions } from 'react-native';
33
import MaskLayer, { MaskLayerProps } from '../MaskLayer';
44

5+
let MainWidth = Dimensions.get('window').width;
6+
let MainHeight = Dimensions.get('window').height;
7+
58
export interface ModalProps extends MaskLayerProps {
69
placement?: 'top' | 'right' | 'bottom' | 'left';
710
onClosed?: () => void;
@@ -116,22 +119,26 @@ const styles = StyleSheet.create({
116119
},
117120
top: {
118121
top: 0,
122+
width: MainWidth,
119123
left: 0,
120124
right: 0,
121125
},
122126
bottom: {
123127
bottom: 0,
124128
left: 0,
129+
width: MainWidth,
125130
right: 0,
126131
},
127132
left: {
128133
bottom: 0,
129134
top: 0,
135+
height: MainHeight,
130136
left: 0,
131137
},
132138
right: {
133139
bottom: 0,
134140
top: 0,
141+
height: MainHeight,
135142
right: 0,
136143
},
137144
});

0 commit comments

Comments
 (0)