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

Remove dist from gitignore and yarn run build #2

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ example/android/app/src/main/gen

# build
react-native-fast-image-*.tgz
dist/

# coverage reports
coverage
100 changes: 100 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import React from 'react';
import { FlexStyle, LayoutChangeEvent, ShadowStyleIOS, StyleProp, TransformsStyle } from 'react-native';
declare type ResizeMode = 'contain' | 'cover' | 'stretch' | 'center';
declare const resizeMode: {
readonly contain: "contain";
readonly cover: "cover";
readonly stretch: "stretch";
readonly center: "center";
};
declare type Priority = 'low' | 'normal' | 'high';
declare const priority: {
readonly low: "low";
readonly normal: "normal";
readonly high: "high";
};
declare type Cache = 'low' | 'normal' | 'high';
declare const cacheControl: {
readonly immutable: "immutable";
readonly web: "web";
readonly cacheOnly: "cacheOnly";
};
export declare type Source = {
uri?: string;
headers?: {
[key: string]: string;
};
priority?: Priority;
cache?: Cache;
};
export interface OnLoadEvent {
nativeEvent: {
width: number;
height: number;
};
}
export interface OnProgressEvent {
nativeEvent: {
loaded: number;
total: number;
};
}
export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
backfaceVisibility?: 'visible' | 'hidden';
borderBottomLeftRadius?: number;
borderBottomRightRadius?: number;
backgroundColor?: string;
borderColor?: string;
borderWidth?: number;
borderRadius?: number;
borderTopLeftRadius?: number;
borderTopRightRadius?: number;
overlayColor?: string;
tintColor?: string;
opacity?: number;
}
export interface FastImageProps {
source: Source | number;
resizeMode?: ResizeMode;
fallback?: boolean;
onLoadStart?(): void;
onProgress?(event: OnProgressEvent): void;
onLoad?(event: OnLoadEvent): void;
onError?(): void;
onLoadEnd?(): void;
/**
* onLayout function
*
* Invoked on mount and layout changes with
*
* {nativeEvent: { layout: {x, y, width, height}}}.
*/
onLayout?: (event: LayoutChangeEvent) => void;
/**
*
* Style
*/
style?: StyleProp<ImageStyle>;
/**
* TintColor
*
* If supplied, changes the color of all the non-transparent pixels to the given color.
*/
tintColor?: number | string;
/**
* A unique identifier for this element to be used in UI Automation testing scripts.
*/
testID?: string;
/**
* Render children within the image.
*/
children?: React.ReactNode;
}
interface FastImageStaticProperties {
resizeMode: typeof resizeMode;
priority: typeof priority;
cacheControl: typeof cacheControl;
preload: (sources: Source[]) => void;
}
declare const FastImage: React.ComponentType<FastImageProps> & FastImageStaticProperties;
export default FastImage;
8 changes: 8 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./react-native-fast-image.cjs.production.min.js')
} else {
module.exports = require('./react-native-fast-image.cjs.development.js')
}
71 changes: 71 additions & 0 deletions dist/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// @flow

import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes'
import type { SyntheticEvent } from 'react-native/Libraries/Types/CoreEventTypes'

export type OnLoadEvent = SyntheticEvent<
$ReadOnly<{
width: number,
height: number,
}>,
>

export type OnProgressEvent = SyntheticEvent<
$ReadOnly<{|
loaded: number,
total: number,
|}>,
>

export type ResizeMode = $ReadOnly<{|
contain: 'contain',
cover: 'cover',
stretch: 'stretch',
center: 'center',
|}>

export type Priority = $ReadOnly<{|
low: 'low',
normal: 'normal',
high: 'high',
|}>

export type CacheControl = $ReadOnly<{|
immutable: 'immutable',
web: 'web',
cacheOnly: 'cacheOnly',
|}>

export type ResizeModes = $Values<ResizeMode>
export type Priorities = $Values<Priority>
export type CacheControls = $Values<CacheControl>

export type PreloadFn = (sources: Array<FastImageSource>) => void
export type FastImageSource = {
uri?: string,
headers?: Object,
priority?: Priorities,
cache?: CacheControls,
}

export type FastImageProps = $ReadOnly<{|
...ViewProps,
onError?: ?() => void,
onLoad?: ?(event: OnLoadEvent) => void,
onLoadEnd?: ?() => void,
onLoadStart?: ?() => void,
onProgress?: ?(event: OnProgressEvent) => void,

source: FastImageSource | number,

resizeMode?: ?ResizeModes,
fallback?: ?boolean,
testID?: ?string,
|}>

declare export default class FastImage extends React$Component<FastImageProps> {
static resizeMode: ResizeMode;
static priority: Priority;
static cacheControl: CacheControl;
static preload: PreloadFn;
}
1 change: 1 addition & 0 deletions dist/index.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
130 changes: 130 additions & 0 deletions dist/react-native-fast-image.cjs.development.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/react-native-fast-image.cjs.development.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/react-native-fast-image.cjs.production.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading