Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/commons/baseComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function baseComponent(usePure) {

// TODO: remove this after migrating all components to use asBaseComponent HOC
UNSAFE_componentWillReceiveProps(nextProps) {
this.updateModifiers(this.props, nextProps);
this.updateModifiers(this.getThemeProps(), nextProps);
}

// TODO: stop using this and remove it
Expand All @@ -53,7 +53,7 @@ export default function baseComponent(usePure) {
extractColorValue = () => Modifiers.extractColorValue(this.getThemeProps());

extractAnimationProps() {
return _.pick(this.props, [
return _.pick(this.getThemeProps(), [
'animation',
'duration',
'delay',
Expand All @@ -68,7 +68,7 @@ export default function baseComponent(usePure) {
}

extractModifierProps() {
return Modifiers.extractModifierProps(this.props);
return Modifiers.extractModifierProps(this.getThemeProps());
}

// TODO: stop using this and remove it
Expand Down Expand Up @@ -124,7 +124,7 @@ export default function baseComponent(usePure) {
alignments: true,
flex: true
},
props = this.props,) {
props = this.getThemeProps(),) {
const style = {};

if (options.backgroundColor) {
Expand Down
25 changes: 13 additions & 12 deletions src/components/dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ class Dialog extends BaseComponent {
*/
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/**
* The direction of the allowed pan (default is DOWN)
* Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###)
* The direction of the allowed pan (default is DOWN).
* Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###).
* Pass null to remove pan.
*/
panDirection: PropTypes.oneOf(Object.values(PanningProvider.Directions)),
/**
Expand Down Expand Up @@ -78,8 +79,7 @@ class Dialog extends BaseComponent {
};

static defaultProps = {
overlayBackgroundColor: Colors.rgba(Colors.dark10, 0.6),
width: '90%'
overlayBackgroundColor: Colors.rgba(Colors.dark10, 0.6)
};

constructor(props) {
Expand Down Expand Up @@ -122,7 +122,7 @@ class Dialog extends BaseComponent {
};

generateStyles() {
this.styles = createStyles(this.props);
this.styles = createStyles(this.getThemeProps());
}

setAlignment() {
Expand All @@ -136,8 +136,9 @@ class Dialog extends BaseComponent {

onDismiss = () => {
this.setState({modalVisibility: false}, () => {
if (this.props.visible) {
_.invoke(this.props, 'onDismiss', this.props);
const props = this.getThemeProps();
if (props.visible) {
_.invoke(props, 'onDismiss', props);
}
});
};
Expand All @@ -147,14 +148,14 @@ class Dialog extends BaseComponent {
};

renderPannableHeader = directions => {
const {renderPannableHeader, pannableHeaderProps} = this.props;
const {renderPannableHeader, pannableHeaderProps} = this.getThemeProps();
if (renderPannableHeader) {
return <PanListenerView directions={directions}>{renderPannableHeader(pannableHeaderProps)}</PanListenerView>;
}
};

renderDialogView = () => {
const {children, renderPannableHeader, panDirection, containerStyle, testID} = this.props;
const {children, renderPannableHeader, panDirection = PanningProvider.Directions.DOWN, containerStyle, testID} = this.getThemeProps();
const {dialogVisibility} = this.state;
const Container = renderPannableHeader ? View : PanListenerView;

Expand All @@ -178,9 +179,9 @@ class Dialog extends BaseComponent {
);
};

// TODO: renderOverlay {_.invoke(this.props, 'renderOverlay')}
// TODO: renderOverlay {_.invoke(this.getThemeProps(), 'renderOverlay')}
renderDialogContainer = () => {
const {useSafeArea, bottom} = this.props;
const {useSafeArea, bottom} = this.getThemeProps();
const addBottomSafeArea = Constants.isIphoneX && (useSafeArea && bottom);
const bottomInsets = Constants.getSafeAreaInsets().bottom - 8; // TODO: should this be here or in the input style?

Expand Down Expand Up @@ -220,7 +221,7 @@ class Dialog extends BaseComponent {
}

function createStyles(props) {
const {width, height} = props;
const {width = '90%', height} = props;
const flexType = height ? {flex: 1} : {flex: 0};
return StyleSheet.create({
dialogViewSize: {width, height},
Expand Down