Skip to content

Commit

Permalink
Part 1 - Code Scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
sketchthat committed Jan 7, 2019
0 parents commit 3b07400
Show file tree
Hide file tree
Showing 13 changed files with 5,016 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p12
*.key
*.mobileprovision
.DS_Store
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
59 changes: 59 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import { StyleSheet, Platform, StatusBar } from 'react-native';
import { Container, Content, Root, View, Spinner } from 'native-base';
import TitleBar from './global/TitleBar';
import Coin from './charts/Coin';

export default class App extends React.Component {
constructor(props) {
super(props);

this.state = {
loading: true,
};
}

componentWillMount() {
Expo.Font.loadAsync({
'Roboto': require('native-base/Fonts/Roboto.ttf'),
'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
})
.then(() => {
this.setState({
loading: false,
});
});
}

render() {
const { loading } = this.state;

if (loading) {
return (<Spinner />);
}

return (
<Root>
<View style={styles.container}>
<Container>
<TitleBar title="Crypto Tracker" />
<Content>
<Coin />
</Content>
</Container>
</View>
</Root>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
android: {
marginTop: StatusBar.currentHeight,
},
}),
},
});
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build a React Native Crypto Currency Tracker

![React Native Application](./assets_readme/final-screen.png "React Native Application")

Tutorial can be found on [Medium](https://medium.com/@michael.kimpton/build-a-react-native-crypto-currency-tracker-part-1-3ca404accbbb).

Check out the [releases](https://github.com/sketchthat/react-native-crypto-tracker/releases) for the tutorial stages.
29 changes: 29 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"expo": {
"name": "react-native-crypto-tracker",
"slug": "react-native-crypto-tracker",
"privacy": "public",
"sdkVersion": "31.0.0",
"platforms": [
"ios",
"android"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets_readme/final-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
34 changes: 34 additions & 0 deletions charts/Coin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { Component } from 'react';
import { Card, CardItem, Left, Right, Body, Text, Thumbnail } from 'native-base';

class Coin extends Component {
render() {
return (
<Card>
<CardItem>
<Left>
<Thumbnail source={{uri: 'https://raw.githubusercontent.com/atomiclabs/cryptocurrency-icons/master/128/color/btc.png'}} />
<Body>
<Text>BTC/USDT</Text>
<Text note>30m</Text>
</Body>
</Left>
</CardItem>
<CardItem>
<Text>Chart...</Text>
</CardItem>
<CardItem footer>
<Left>
<Text>5%</Text>
</Left>
<Body />
<Right>
<Text>$3,500.00</Text>
</Right>
</CardItem>
</Card>
);
}
}

export default Coin;
19 changes: 19 additions & 0 deletions global/TitleBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Header, Left, Body, Right, Title } from 'native-base';

const TitleBar = ({title}) => (
<Header>
<Body>
<Left />
<Title>{title}</Title>
<Right />
</Body>
</Header>
);

export default TitleBar;

TitleBar.propTypes = {
title: PropTypes.string,
};
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"expo": "^31.0.2",
"native-base": "^2.10.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
},
"private": true
}
Loading

0 comments on commit 3b07400

Please sign in to comment.