Skip to content
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
5 changes: 5 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const PEXELS_API_KEY = process.env.PEXELS_API_KEY ?? '';

if (!PEXELS_API_KEY) {
console.warn('PEXELS_API_KEY environment variable is not defined');
}
6 changes: 1 addition & 5 deletions src/screens/GalleryScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ import {useInfiniteQuery} from '@tanstack/react-query';
import {getCollectionsMedia} from '../api/api';
import ImageViewer from '../components/ImageViewer';
import HeartWithLiquidActivityIndicator from '../components/HearthWithLiquidActivityIndicator';
import {PEXELS_API_KEY} from '../config/env';

const GalleryScreen: React.FC<GalleryScreenProps> = props => {
const PEXELS_API_KEY = process.env.PEXELS_API_KEY ?? '';
if (!PEXELS_API_KEY) {
console.warn('PEXELS_API_KEY environment variable is not defined');
}

const {item} = props.route.params;

const {
Expand Down
6 changes: 1 addition & 5 deletions src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from '../types/types';
import {useNavigation} from '@react-navigation/native';
import HeartWithLiquidActivityIndicator from '../components/HearthWithLiquidActivityIndicator';
import {PEXELS_API_KEY} from '../config/env';

const ITEM_HEIGHT = 60;
const SEPARATOR_HEIGHT = 12;
Expand Down Expand Up @@ -62,11 +63,6 @@ const ErrorMessage: React.FC<{onRetry: () => void}> = ({onRetry}) => (
);

const HomeScreen: React.FC = () => {
const PEXELS_API_KEY = process.env.PEXELS_API_KEY ?? '';
if (!PEXELS_API_KEY) {
console.warn('PEXELS_API_KEY environment variable is not defined');
}

const {
data,
fetchNextPage,
Expand Down