Skip to content

Commit 2bdf7cc

Browse files
committed
initial commit
0 parents  commit 2bdf7cc

24 files changed

+8091
-0
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
keys.json
2+
node_modules/**/*
3+
.expo/*
4+
npm-debug.*
5+
*.jks
6+
*.p8
7+
*.p12
8+
*.key
9+
*.mobileprovision
10+
*.orig.*
11+
web-build/
12+
13+
# macOS
14+
.DS_Store
15+
16+
17+
18+

App.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from "react";
2+
import { SafeAreaProvider } from "react-native-safe-area-context";
3+
import { DefaultTheme, Provider as PaperProvider } from "react-native-paper";
4+
import { COLOR_ACCENT, COLOR_PRIMARY } from "./AppStyles";
5+
import firebase from "firebase";
6+
import { EntryStackScreen } from "./screens/EntryStackScreen";
7+
8+
// TODO: Make sure to create a file called "keys.json" in your project
9+
// directory & add your Firebase configuration keys to that file.
10+
// We add this file to our gitignore, since we don't want this to be
11+
// published on Version Control.
12+
const firebaseConfig = require("./keys.json");
13+
14+
if (firebase.apps.length == 0) {
15+
firebase.initializeApp(firebaseConfig);
16+
}
17+
18+
// Theme Object for React Native Paper
19+
const theme = {
20+
...DefaultTheme,
21+
roundness: 2,
22+
colors: {
23+
...DefaultTheme.colors,
24+
primary: COLOR_PRIMARY,
25+
accent: COLOR_ACCENT,
26+
},
27+
};
28+
29+
export default function App() {
30+
// To use React Native Paper, we wrap our EntryStackScreen in
31+
// PaperProvider.
32+
// Learn More: https://callstack.github.io/react-native-paper/getting-started.html#usage
33+
return (
34+
<SafeAreaProvider>
35+
<PaperProvider theme={theme}>
36+
<EntryStackScreen />
37+
</PaperProvider>
38+
</SafeAreaProvider>
39+
);
40+
}

AppStyles.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from "react";
2+
import { StyleSheet } from "react-native";
3+
4+
export const COLOR_PRIMARY = "#0984e3";
5+
export const COLOR_ACCENT = "#dfe6e9";
6+
export const COLOR_LIGHT = "#dfe6e9";
7+
export const COLOR_DARK = "#2d3436";
8+
export const COLOR_BACKGROUND = "#ffffff";
9+
10+
export const AppStyles = StyleSheet.create({
11+
container: {
12+
flex: 1,
13+
backgroundColor: COLOR_BACKGROUND,
14+
},
15+
h1: {
16+
fontSize: 32,
17+
},
18+
h2: {
19+
fontSize: 24,
20+
},
21+
h3: {
22+
fontSize: 20,
23+
},
24+
body: {
25+
fontSize: 14,
26+
},
27+
});

Utils.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Source: https://stackoverflow.com/questions/5933565/how-to-create-initialize-the-file-object-using-file-path-html5
2+
export const getFileBlob = function (url, cb) {
3+
var xhr = new XMLHttpRequest();
4+
xhr.open("GET", url);
5+
xhr.responseType = "blob";
6+
xhr.addEventListener("load", function () {
7+
cb(xhr.response);
8+
});
9+
xhr.send();
10+
};
11+
12+
export const blobToFile = function (blob, name) {
13+
blob.lastModifiedDate = new Date();
14+
blob.name = name;
15+
return blob;
16+
};
17+
18+
export const getFileObject = function (filePathOrUrl, cb) {
19+
getFileBlob(filePathOrUrl, function (blob) {
20+
cb(blobToFile(blob, "test.jpg"));
21+
});
22+
};
23+
24+
export const getFileObjectAsync = async function (filePathOrUrl: string) {
25+
return new Promise((resolve, reject) => {
26+
try {
27+
getFileBlob(filePathOrUrl, function (blob) {
28+
resolve(blobToFile(blob, "test.jpg"));
29+
});
30+
} catch (error) {
31+
reject(error);
32+
}
33+
});
34+
};

app.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"expo": {
3+
"name": "reactnative-mp3-a",
4+
"slug": "reactnative-mp3-a",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"splash": {
9+
"image": "./assets/splash.png",
10+
"resizeMode": "contain",
11+
"backgroundColor": "#ffffff"
12+
},
13+
"updates": {
14+
"fallbackToCacheTimeout": 0
15+
},
16+
"assetBundlePatterns": ["**/*"],
17+
"ios": {
18+
"supportsTablet": true,
19+
"infoPlist": {
20+
"NSPhotoLibraryUsageDescription": "This app needs access to your photo library."
21+
}
22+
},
23+
"android": {
24+
"adaptiveIcon": {
25+
"foregroundImage": "./assets/adaptive-icon.png",
26+
"backgroundColor": "#FFFFFF"
27+
}
28+
},
29+
"web": {
30+
"favicon": "./assets/favicon.png"
31+
}
32+
}
33+
}

assets/adaptive-icon.png

17.1 KB
Loading

assets/favicon.png

1.43 KB
Loading

assets/icon.png

21.9 KB
Loading

assets/splash.png

47.3 KB
Loading

babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

0 commit comments

Comments
 (0)