react-native-photo-view initial commit (#24812)

This commit is contained in:
Christian Chown
2018-04-09 17:54:16 +01:00
committed by Mohamed Hegazy
parent 6a9edddf73
commit 6fda8a5f9d
4 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
// Type definitions for react-native-photo-view 1.5
// Project: https://github.com/alwx/react-native-photo-view
// Definitions by: Christian Chown <https://github.com/christianchown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
import { ImagePropertiesSourceOptions, ViewProperties } from 'react-native';
export interface ReactNativePhotoViewProps {
source?: ImagePropertiesSourceOptions;
loadingIndicatorSource?: ImagePropertiesSourceOptions;
fadeDuration?: number;
minimumZoomScale?: number;
maximumZoomScale?: number;
showsHorizontalScrollIndicator?: boolean;
showsVerticalScrollIndicator?: boolean;
scale?: number;
androidZoomTransitionDuration?: number;
androidScaleType?: 'center' | 'centerCrop' | 'centerInside' | 'fitCenter' | 'fitStart' | 'fitEnd' | 'fitXY';
onLoadStart?: () => void;
onLoad?: () => void;
onLoadEnd?: () => void;
onProgress?: (loaded: number, total: number) => void;
onTap?: (point: {x: number, y: number}, target?: React.ReactElement<any>) => void;
onViewTap?: (point: {x: number, y: number}, target?: React.ReactElement<any>) => void;
onScale?: (scale: number, target?: React.ReactElement<any>) => void;
}
export default class ReactNativePhotoView extends React.Component<ReactNativePhotoViewProps & ViewProperties> {}

View File

@@ -0,0 +1,38 @@
import * as React from 'react';
import ReactNativePhotoView from 'react-native-photo-view';
const test: React.SFC = () => (
<ReactNativePhotoView
source={{uri: 'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Logo.png'}}
loadingIndicatorSource={{uri: 'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png'}}
fadeDuration={100}
minimumZoomScale={0}
maximumZoomScale={1}
showsHorizontalScrollIndicator={true}
showsVerticalScrollIndicator={true}
scale={0.5}
androidZoomTransitionDuration={1000}
androidScaleType="center"
onLoadStart={() => {
console.log('onLoadStart');
}}
onLoad={() => {
console.log('onLoad');
}}
onLoadEnd={() => {
console.log('onLoadEnd');
}}
onProgress={(loaded: number, total: number) => {
console.log(`onProgress ${loaded}/${total}`);
}}
onTap={(point: {x: number; y: number}, target?: React.ReactElement<any>) => {
console.log('onTap');
}}
onViewTap={(point: {x: number; y: number}, target?: React.ReactElement<any>) => {
console.log(`onViewTap ${point.x},${point.y} ${!!target ? 'targetted' : ''}`);
}}
onScale={(scale: number, target?: React.ReactElement<any>) => {
console.log(`onScale ${scale} ${!!target ? 'targetted' : ''}`);
}}
/>
);

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react-native",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-native-photo-view-tests.tsx"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }