Skip to content

Commit

Permalink
feat(react-pdf): add react-pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed May 25, 2018
1 parent 8935a9f commit 0bfb2b2
Show file tree
Hide file tree
Showing 24 changed files with 4,858 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ typings/

# dotenv environment variables file
.env

.expo
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
example
scripts
bundleContainer.js
38 changes: 38 additions & 0 deletions bundleContainer.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions example/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
},
"plugins": [
["module-resolver", {
"alias": {
"rn-pdf-reader-js": ".."
}
}]
]
}
3 changes: 3 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/**/*
.expo/*
npm-debug.*
1 change: 1 addition & 0 deletions example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
22 changes: 22 additions & 0 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import { StyleSheet, Text, View, WebView } from 'react-native';
import PdfReader from 'rn-pdf-reader-js';
import { Constants } from 'expo';

export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<PdfReader url="http://gahp.net/wp-content/uploads/2017/09/sample.pdf" />
</View>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
},
});
31 changes: 31 additions & 0 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"expo": {
"name": "rn-pdf-reader-example",
"description": "This project is really great.",
"slug": "rn-pdf-reader-example",
"privacy": "public",
"sdkVersion": "27.0.0",
"platforms": ["ios", "android"],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"packagerOpts": {
"config": "./rn-cli.config.js",
"projectRoots": ""
}
}
}
Binary file added example/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"main": "node_modules/expo/AppEntry.js",
"private": true,
"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz"
},
"devDependencies": {
"babel-plugin-module-resolver": "3.1.1",
"glob-to-regexp": "0.4.0"
}
}
20 changes: 20 additions & 0 deletions example/rn-cli.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

const path = require('path');
const blacklist = require('metro/src/blacklist');
const glob = require('glob-to-regexp');
const pak = require('../package.json');

const dependencies = Object.keys(pak.dependencies || {});
const peerDependencies = Object.keys(pak.peerDependencies || {});

module.exports = {
getProjectRoots() {
return [__dirname, path.resolve(__dirname, '..')];
},
getProvidesModuleNodeModules() {
return [...dependencies, ...peerDependencies];
},
getBlacklistRE() {
return blacklist([glob(`${path.resolve(__dirname, '..')}/node_modules/*`)]);
},
};
Loading

0 comments on commit 0bfb2b2

Please sign in to comment.