Skip to content

Commit

Permalink
fix(android) - initialPage prop #312 (#322)
Browse files Browse the repository at this point in the history
* fix #312 - no initial page load on Android

* Update PagerView.tsx

Co-authored-by: troZee <12766071+troZee@users.noreply.github.com>
  • Loading branch information
Lukas-Heiligenbrunner and troZee committed Apr 8, 2021
1 parent 962468b commit fe0de05
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/PagerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ 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) {
requestAnimationFrame(() => {
if (this.props.initialPage !== undefined) {
this.setPageWithoutAnimation(this.props.initialPage);
}
});
}
}

Expand Down

0 comments on commit fe0de05

Please sign in to comment.