Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const COLUMNS = 3;
const PAGE_SIZE = COLUMNS * 10;
const WINDOW_SIZE = Dimensions.get('window');
const mediaTypeStates: { [key in MediaLibrary.MediaTypeValue]: MediaLibrary.MediaTypeValue } = {
[MediaLibrary.MediaType.unknown]: MediaLibrary.MediaType.photo,
[MediaLibrary.MediaType.photo]: MediaLibrary.MediaType.video,
[MediaLibrary.MediaType.video]: MediaLibrary.MediaType.audio,
[MediaLibrary.MediaType.audio]: MediaLibrary.MediaType.unknown,
};
const sortByStates: { [key in MediaLibrary.SortByKey]: MediaLibrary.SortByKey } = {
[MediaLibrary.SortBy.default]: MediaLibrary.SortBy.creationTime,
[MediaLibrary.SortBy.creationTime]: MediaLibrary.SortBy.modificationTime,
[MediaLibrary.SortBy.modificationTime]: MediaLibrary.SortBy.mediaType,
[MediaLibrary.SortBy.mediaType]: MediaLibrary.SortBy.width,
[MediaLibrary.SortBy.width]: MediaLibrary.SortBy.height,
[MediaLibrary.SortBy.height]: MediaLibrary.SortBy.duration,
[MediaLibrary.SortBy.duration]: MediaLibrary.SortBy.default,
};
interface State {
assets: MediaLibrary.Asset[];
endCursor?: string;
hasNextPage?: boolean;
permission?: Permissions.PermissionStatus;
refreshing: boolean;
mediaType: MediaLibrary.MediaTypeValue;
sortBy: MediaLibrary.SortByKey;
}
import Button from '../../components/Button';
import HeadingText from '../../components/HeadingText';
const COLUMNS = 3;
const PAGE_SIZE = COLUMNS * 10;
const WINDOW_SIZE = Dimensions.get('window');
const mediaTypeStates: { [key in MediaLibrary.MediaTypeValue]: MediaLibrary.MediaTypeValue } = {
[MediaLibrary.MediaType.unknown]: MediaLibrary.MediaType.photo,
[MediaLibrary.MediaType.photo]: MediaLibrary.MediaType.video,
[MediaLibrary.MediaType.video]: MediaLibrary.MediaType.audio,
[MediaLibrary.MediaType.audio]: MediaLibrary.MediaType.unknown,
};
const sortByStates: { [key in MediaLibrary.SortByKey]: MediaLibrary.SortByKey } = {
[MediaLibrary.SortBy.default]: MediaLibrary.SortBy.creationTime,
[MediaLibrary.SortBy.creationTime]: MediaLibrary.SortBy.modificationTime,
[MediaLibrary.SortBy.modificationTime]: MediaLibrary.SortBy.mediaType,
[MediaLibrary.SortBy.mediaType]: MediaLibrary.SortBy.width,
[MediaLibrary.SortBy.width]: MediaLibrary.SortBy.height,
[MediaLibrary.SortBy.height]: MediaLibrary.SortBy.duration,
[MediaLibrary.SortBy.duration]: MediaLibrary.SortBy.default,
};
interface State {
assets: MediaLibrary.Asset[];
endCursor?: string;
hasNextPage?: boolean;
permission?: Permissions.PermissionStatus;
refreshing: boolean;
mediaType: MediaLibrary.MediaTypeValue;
sortBy: MediaLibrary.SortByKey;
const PAGE_SIZE = COLUMNS * 10;
const WINDOW_SIZE = Dimensions.get('window');
const mediaTypeStates: { [key in MediaLibrary.MediaTypeValue]: MediaLibrary.MediaTypeValue } = {
[MediaLibrary.MediaType.unknown]: MediaLibrary.MediaType.photo,
[MediaLibrary.MediaType.photo]: MediaLibrary.MediaType.video,
[MediaLibrary.MediaType.video]: MediaLibrary.MediaType.audio,
[MediaLibrary.MediaType.audio]: MediaLibrary.MediaType.unknown,
};
const sortByStates: { [key in MediaLibrary.SortByKey]: MediaLibrary.SortByKey } = {
[MediaLibrary.SortBy.default]: MediaLibrary.SortBy.creationTime,
[MediaLibrary.SortBy.creationTime]: MediaLibrary.SortBy.modificationTime,
[MediaLibrary.SortBy.modificationTime]: MediaLibrary.SortBy.mediaType,
[MediaLibrary.SortBy.mediaType]: MediaLibrary.SortBy.width,
[MediaLibrary.SortBy.width]: MediaLibrary.SortBy.height,
[MediaLibrary.SortBy.height]: MediaLibrary.SortBy.duration,
[MediaLibrary.SortBy.duration]: MediaLibrary.SortBy.default,
};
interface State {
assets: MediaLibrary.Asset[];
endCursor?: string;
hasNextPage?: boolean;
permission?: Permissions.PermissionStatus;
refreshing: boolean;
mediaType: MediaLibrary.MediaTypeValue;
sortBy: MediaLibrary.SortByKey;
}
@connect()
export default class MediaLibraryScreen extends React.Component {
const RNButton = Button;
const COLUMNS = 3;
const PAGE_SIZE = COLUMNS * 10;
const WINDOW_SIZE = Dimensions.get('window');
const mediaTypeStates: { [key in MediaLibrary.MediaTypeValue]: MediaLibrary.MediaTypeValue } = {
[MediaLibrary.MediaType.unknown]: MediaLibrary.MediaType.photo,
[MediaLibrary.MediaType.photo]: MediaLibrary.MediaType.video,
[MediaLibrary.MediaType.video]: MediaLibrary.MediaType.audio,
[MediaLibrary.MediaType.audio]: MediaLibrary.MediaType.unknown,
};
const sortByStates: { [key in MediaLibrary.SortByKey]: MediaLibrary.SortByKey } = {
[MediaLibrary.SortBy.default]: MediaLibrary.SortBy.creationTime,
[MediaLibrary.SortBy.creationTime]: MediaLibrary.SortBy.modificationTime,
[MediaLibrary.SortBy.modificationTime]: MediaLibrary.SortBy.mediaType,
[MediaLibrary.SortBy.mediaType]: MediaLibrary.SortBy.width,
[MediaLibrary.SortBy.width]: MediaLibrary.SortBy.height,
[MediaLibrary.SortBy.height]: MediaLibrary.SortBy.duration,
[MediaLibrary.SortBy.duration]: MediaLibrary.SortBy.default,
};
interface State {
assets: MediaLibrary.Asset[];
endCursor?: string;
hasNextPage?: boolean;
permission?: Permissions.PermissionStatus;
refreshing: boolean;
mediaType: MediaLibrary.MediaTypeValue;
sortBy: MediaLibrary.SortByKey;