mattermost-mobile/types/screens/gallery.d.ts
Elias Nahum 5de54471b7
[Gekidou] Gallery (#6008)
* Gallery screen (ground work)

* Open the gallery from posts

* Open the gallery from post draft

* feedback review

* Feedback review 2

* do not remove dm channel names and localization fix

* update to the latest network-client

* do not override file width, height and imageThumbail if received file does not have it set

* bring back ScrollView wrapper for message component

* Remove Text wrapper for markdown paragraph

* Fix YouTube play icon placeholder

* Make video file play button container round

* Add gif image placeholder

* Save images & videos to camera roll

* Feedback review 3

* load video thumbnail when post is in viewport

* simplify prefix
2022-03-01 13:55:44 -03:00

72 lines
1.9 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
type GalleryManagerSharedValues = {
width: Animated.SharedValue<number>;
height: Animated.SharedValue<number>;
x: Animated.SharedValue<number>;
y: Animated.SharedValue<number>;
opacity: Animated.SharedValue<number>;
activeIndex: Animated.SharedValue<number>;
targetWidth: Animated.SharedValue<number>;
targetHeight: Animated.SharedValue<number>;
}
type Context = { [key: string]: any };
type Handler<T, TContext extends Context> = (
event: T,
context: TContext,
) => void;
type onEndHandler<T, TContext extends Context> = (
event: T,
context: TContext,
isCanceled: boolean,
) => void;
type ReturnHandler<T, TContext extends Context, R> = (
event: T,
context: TContext,
) => R;
interface GestureHandlers<T, TContext extends Context> {
onInit?: Handler<T, TContext>;
onEvent?: Handler<T, TContext>;
shouldHandleEvent?: ReturnHandler<T, TContext, boolean>;
shouldCancel?: ReturnHandler<T, TContext, boolean>;
onGesture?: Handler<T, TContext>;
beforeEach?: Handler<T, TContext>;
afterEach?: Handler<T, TContext>;
onStart?: Handler<T, TContext>;
onActive?: Handler<T, TContext>;
onEnd?: onEndHandler<T, TContext>;
onFail?: Handler<T, TContext>;
onCancel?: Handler<T, TContext>;
onFinish?: (
event: T,
context: TContext,
isCanceledOrFailed: boolean,
) => void;
}
type OnGestureEvent<T extends GestureHandlerGestureEvent> = (
event: T,
) => void;
type GalleryItemType = {
type: 'image' | 'video' | 'file';
id: string;
width: number;
height: number;
uri: string;
name: string;
posterUri?: string;
extension?: string;
mime_type: string;
authorId?: string;
size?: number;
postId?: string;
};
type GalleryAction = 'none' | 'downloading' | 'copying' | 'sharing' | 'opening';