Skip to content

Commit 5e41a22

Browse files
authored
Environment Variables (#69)
* Clean up frontend * Fix linting issue * Add environment variables * Sneak in fix for typescript compiler error * Clean up frontend (#68) * Clean up frontend * Fix linting issue
1 parent 5f0445f commit 5e41a22

File tree

7 files changed

+43
-29
lines changed

7 files changed

+43
-29
lines changed

frontend/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ yarn-error.*
3636
*.tsbuildinfo
3737

3838
app-example
39+
40+
.env

frontend/app/(tabs)/explore.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import React from 'react';
2-
import { Text, SafeAreaView } from 'react-native';
2+
import { Text, SafeAreaView, Button } from 'react-native';
3+
import { TEST } from 'react-native-dotenv';
34

45
export default function TabTwoScreen() {
56
return (
67
<SafeAreaView>
78
<Text>Tab Two</Text>
9+
<Button
10+
title="asdf"
11+
onPress={() => {
12+
console.log(TEST);
13+
}}
14+
/>
815
</SafeAreaView>
916
);
1017
}

frontend/babel.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = function (api) {
2+
api.cache(false);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
plugins: [
6+
[
7+
'module:react-native-dotenv',
8+
{
9+
moduleName: 'react-native-dotenv',
10+
verbose: false,
11+
},
12+
],
13+
],
14+
};
15+
};

frontend/components/ExternalLink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function ExternalLink({ href, ...rest }: Props) {
1111
<Link
1212
target="_blank"
1313
{...rest}
14+
//@ts-ignore
1415
href={href}
1516
onPress={async (event) => {
1617
if (Platform.OS !== 'web') {

frontend/components/ParallaxScrollView.tsx

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import type { PropsWithChildren, ReactElement } from 'react';
22
import { StyleSheet } from 'react-native';
3-
import Animated, {
4-
interpolate,
5-
useAnimatedRef,
6-
useAnimatedStyle,
7-
useScrollViewOffset,
8-
} from 'react-native-reanimated';
3+
import Animated, { useAnimatedRef } from 'react-native-reanimated';
94

105
import { ThemedView } from './ThemedView';
116
import { useBottomTabOverflow } from './ui/TabBarBackground';
@@ -26,28 +21,8 @@ export default function ParallaxScrollView({
2621
}: Props) {
2722
const colorScheme = useColorScheme() ?? 'light';
2823
const scrollRef = useAnimatedRef<Animated.ScrollView>();
29-
const scrollOffset = useScrollViewOffset(scrollRef);
3024
const bottom = useBottomTabOverflow();
31-
const headerAnimatedStyle = useAnimatedStyle(() => {
32-
return {
33-
transform: [
34-
{
35-
translateY: interpolate(
36-
scrollOffset.value,
37-
[-HEADER_HEIGHT, 0, HEADER_HEIGHT],
38-
[-HEADER_HEIGHT / 2, 0, HEADER_HEIGHT * 0.75]
39-
),
40-
},
41-
{
42-
scale: interpolate(
43-
scrollOffset.value,
44-
[-HEADER_HEIGHT, 0, HEADER_HEIGHT],
45-
[2, 1, 1]
46-
),
47-
},
48-
],
49-
};
50-
});
25+
5126

5227
return (
5328
<ThemedView style={styles.container}>
@@ -61,7 +36,6 @@ export default function ParallaxScrollView({
6136
style={[
6237
styles.header,
6338
{ backgroundColor: headerBackgroundColor[colorScheme] },
64-
headerAnimatedStyle,
6539
]}
6640
>
6741
{headerImage}

frontend/package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"eslint-plugin-import": "^2.31.0",
5454
"jest": "^29.2.1",
5555
"jest-expo": "~52.0.3",
56+
"react-native-dotenv": "^3.4.11",
5657
"react-test-renderer": "18.3.1",
5758
"typescript": "^5.3.3"
5859
},

0 commit comments

Comments
 (0)