Skip to content

Commit

Permalink
fix callstack#312 - no initial page load on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas-Heiligenbrunner committed Apr 6, 2021
1 parent 962468b commit 1e2df46
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/PagerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ export class PagerView extends React.Component<PagerViewProps> {

componentDidMount() {
// On iOS we do it directly on the native side
if (Platform.OS === 'android') {
if (this.props.initialPage != null) {
this.setPageWithoutAnimation(this.props.initialPage);
}
if (Platform.OS === 'android' && this.props.initialPage !== undefined) {
// que action to next repaint cycle
requestAnimationFrame(() => {
if (this.props.initialPage !== undefined) {
this.setPageWithoutAnimation(this.props.initialPage);
}
});
}
}

Expand Down

0 comments on commit 1e2df46

Please sign in to comment.