Skip to content

Commit

Permalink
refactor(ui): modal - backdrop style prop type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
artyorsh authored and 32penkin committed Sep 18, 2019
1 parent 37a0090 commit b9658a4
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/framework/ui/modal/modal.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
ViewProps,
StyleSheet,
Dimensions,
ViewStyle,
StyleProp,
} from 'react-native';
import {
ModalService,
Expand All @@ -32,15 +34,10 @@ export const baseModalTestId: string = '@modal/base';
type ChildElement = React.ReactElement<any>;
type ChildrenProp = ChildElement | ChildElement[];

export interface BackdropStyle {
backgroundColor: string;
opacity: number;
}

interface ComponentProps {
visible: boolean;
children: ChildrenProp;
backdropStyle?: BackdropStyle;
backdropStyle?: StyleProp<ViewStyle>;
}

export type ModalProps = ViewProps & ComponentProps & ModalPresentingBased;
Expand Down Expand Up @@ -278,7 +275,7 @@ export class Modal extends React.Component<ModalProps> {
<React.Fragment>
<View
pointerEvents='box-none'
style={[styles.backdropBaseStyles, backdropStyle]}/>
style={[styles.backdrop, backdropStyle]}/>
{modal}
</React.Fragment>
) : modal;
Expand Down Expand Up @@ -308,12 +305,12 @@ const styles = StyleSheet.create({
container: {
position: 'absolute',
},
hiddenModal: {
opacity: 0,
},
backdropBaseStyles: {
backdrop: {
position: 'absolute',
width: screenWidth,
height: screenHeight,
},
hiddenModal: {
opacity: 0,
},
});

0 comments on commit b9658a4

Please sign in to comment.