Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll Indicator was Show center of the screen in react-native-pdf #411

Open
SaGaR1084 opened this issue Nov 15, 2019 · 3 comments
Open

Comments

@SaGaR1084
Copy link

SaGaR1084 commented Nov 15, 2019

Scroll Indicator was Show center of the screen in react-native-pdf

this is my code

import React from 'react';
import { StyleSheet, Dimensions, View } from 'react-native';

import Pdf from 'react-native-pdf';

import ImageHelper from '../../Helpers/ImageHelper';

const {
  InstructionsPDF,
} = ImageHelper;
export default class Instruction extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Pdf
          source={InstructionsPDF}
          onLoadComplete={(numberOfPages, filePath) => {
            console.log(`number of pages: ${numberOfPages}`);
          }}
          onPageChanged={(page, numberOfPages) => {
            console.log(`current page: ${page}`);
          }}
          onError={(error) => {
            console.log(error);
          }}
          onPressLink={(uri) => {
            console.log(`Link presse: ${uri}`)
          }}
          style={styles.pdf} />
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'flex-start',
    alignItems: 'center',
    marginTop: 25,
  },
  pdf: {
    flex: 1,
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height,
  }
});

Screenshot 2019-11-15 at 4 07 24 PM

@SaGaR1084 SaGaR1084 changed the title Scroll Indicator was not hide in react-native-pdf Scroll Indicator was Show center of the screen in react-native-pdf Nov 15, 2019
@wonday
Copy link
Owner

wonday commented Nov 18, 2019

Delete the width and height then try again?

pdf: {
    flex: 1,
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height,
  }

@Adarwall
Copy link

Facing the same problem here... any solution?

@martintreurnicht
Copy link

martintreurnicht commented Jan 27, 2020

I fixed this issue by removing flex: 1, it does cause an issue then were it might cut off the last part of the pdf. My solution for that was to just reduce the height by a fixed amount like height: Dimensions.get('window').height - 50

Seems to work ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants