Skip to content

Commit

Permalink
fix: disable scroll with alwaysOpen props on init
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Feb 5, 2020
1 parent 5fb661f commit 990cba7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
enableBounces: true,
keyboardToggle: false,
keyboardHeight: 0,
disableScroll: undefined,
disableScroll: props.alwaysOpen ? true : undefined,
};

this.beginScrollY.addListener(({ value }) => (this.beginScrollYValue = value));
Expand Down Expand Up @@ -470,10 +470,14 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
useNativeDriver,
}).start();

if (onPositionChange && this.beginScrollYValue === 0) {
if (this.beginScrollYValue === 0) {
const modalPosition = Boolean(destSnapPoint <= 0) ? 'top' : 'initial';

if (this.modalPosition !== modalPosition) {
if (modalPosition === 'top') {
this.setState({ disableScroll: false });
}

if (onPositionChange && this.modalPosition !== modalPosition) {
onPositionChange(modalPosition);
this.modalPosition = modalPosition;
}
Expand Down

0 comments on commit 990cba7

Please sign in to comment.