Skip to content

Commit ef461a8

Browse files
authored
Add static directions (#2060)
1 parent 792eb0c commit ef461a8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

demo/src/screens/componentScreens/DialogScreen.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class DialogScreen extends Component {
5050
];
5151

5252
this.state = {
53-
panDirection: PanningProvider.Directions.DOWN,
53+
panDirection: Dialog.directions.DOWN,
5454
position: 'bottom',
5555
scroll: this.SCROLL_TYPE.NONE,
5656
showHeader: true,
@@ -114,7 +114,7 @@ export default class DialogScreen extends Component {
114114
return (
115115
<Text color={Colors.$textDangerLight}>It is recommended to have pannable header with scrollable content</Text>
116116
);
117-
} else if (showHeader && panDirection !== PanningProvider.Directions.DOWN) {
117+
} else if (showHeader && panDirection !== Dialog.directions.DOWN) {
118118
return <Text color={Colors.$textDangerLight}>It is recommended to have pannable header with direction=down</Text>;
119119
}
120120
};
@@ -270,10 +270,10 @@ Scroll: ${scroll}`;
270270
<Text $textDefault>Panning Direction:</Text>
271271
<View row marginV-10>
272272
<RadioButton value={null} label={'None'}/>
273-
<RadioButton value={PanningProvider.Directions.UP} label={'Up'} marginL-10/>
274-
<RadioButton value={PanningProvider.Directions.DOWN} label={'Down'} marginL-10/>
275-
<RadioButton value={PanningProvider.Directions.LEFT} label={'Left'} marginL-10/>
276-
<RadioButton value={PanningProvider.Directions.RIGHT} label={'Right'} marginL-10/>
273+
<RadioButton value={Dialog.directions.UP} label={'Up'} marginL-10/>
274+
<RadioButton value={Dialog.directions.DOWN} label={'Down'} marginL-10/>
275+
<RadioButton value={Dialog.directions.LEFT} label={'Left'} marginL-10/>
276+
<RadioButton value={Dialog.directions.RIGHT} label={'Right'} marginL-10/>
277277
</View>
278278
</RadioGroup>
279279

src/components/dialog/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import View from '../view';
99
import PanListenerView from '../panningViews/panListenerView';
1010
import DialogDismissibleView from './DialogDismissibleView';
1111
import OverlayFadingBackground from './OverlayFadingBackground';
12-
import PanningProvider, {PanningDirections} from '../panningViews/panningProvider';
12+
import PanningProvider, {PanningDirections, PanningDirectionsEnum} from '../panningViews/panningProvider';
1313

1414
// TODO: KNOWN ISSUES
1515
// 1. iOS pressing on the background while enter animation is happening will not call onDismiss
@@ -104,6 +104,7 @@ const DEFAULT_OVERLAY_BACKGROUND_COLOR = Colors.rgba(Colors.grey20, 0.65);
104104
*/
105105
class Dialog extends Component<DialogProps, DialogState> {
106106
static displayName = 'Dialog';
107+
static directions = PanningDirectionsEnum;
107108

108109
static defaultProps = {
109110
overlayBackgroundColor: DEFAULT_OVERLAY_BACKGROUND_COLOR
@@ -293,4 +294,4 @@ function createStyles(props: DialogProps) {
293294
});
294295
}
295296

296-
export default asBaseComponent<DialogProps>(Dialog);
297+
export default asBaseComponent<DialogProps, typeof Dialog>(Dialog);

0 commit comments

Comments
 (0)