Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the repo to use expo and react-native 0.66 #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

17 changes: 17 additions & 0 deletions .expo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
> Why do I have a folder named ".expo" in my project?
The ".expo" folder is created when an Expo project is started using "expo start" command.

> What does the "packager-info.json" file contain?
The "packager-info.json" file contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.

> What does the "settings.json" file contain?
The "settings.json" file contains the server configuration that is used to serve the application manifest.

> Should I commit the ".expo" folder?
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.

Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
10 changes: 10 additions & 0 deletions .expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devToolsPort": 19002,
"expoServerPort": null,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null,
"webpackServerPort": null
}
10 changes: 10 additions & 0 deletions .expo/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": "fx-4ia",
"https": false,
"scheme": null,
"devClient": false
}
Empty file removed .watchmanconfig
Empty file.
40 changes: 40 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from "react";
import { Text, View } from "react-native";
import AppLoading from "expo-app-loading";
import { useFonts } from "expo-font";
import ProductList from "./screens/ProductList";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";

import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import styles from "./components/theme";
import CartScreen from "./screens/CartScreen";
import HomeScreen from "./screens/HomeScreen";
import BuyNowScreen from "./screens/BuyNowScreen";

const Stack = createNativeStackNavigator();
const BottomTabs = createBottomTabNavigator();
const App = () => {
let [fontsLoaded] = useFonts({
Skyhook: require("./assets/fonts/SkyhookMono.ttf"),
});

if (!fontsLoaded) {
return <AppLoading />;
}

return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ headerShown: false }}
/>
<Stack.Screen name={"Checkout"} component={BuyNowScreen} />
</Stack.Navigator>
</NavigationContainer>
);
};

export default App;
17 changes: 0 additions & 17 deletions AppRouter.js

This file was deleted.

112 changes: 56 additions & 56 deletions Counter.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
/**
* @providesModule Counter
*/

import React from 'react';
import {
Text,
View
} from 'react-native'

import styles from './components/theme'
import Button from './components/button'

import AnimateNumber from 'react-native-animate-number'

export default class Counter extends React.Component {
state = {
value: 1000
}

render() {
return <View style={styles.container}>
<AnimateNumber
interval='10'
timing='easeIn'
value={this.state.value}

style={[styles.customFont, styles.header]}
formatter={(val) => {
return parseFloat(val).toFixed(2);
}}
/>
<View style={styles.groupButton}>
<Button onPress={() => this.incrementValue()} theme='dark'>
Increment
</Button>
<Button onPress={() => this.decrementValue()} theme='light'>
Decrement
</Button>
</View>
<Text style={[styles.customFont, styles.normal]}>Open up main.js to start working on your app!</Text>
</View>
}

decrementValue() {
this.setState({
value: this.state.value - Math.floor(Math.random() * 200)
})
}

incrementValue() {
this.setState({
value: this.state.value + Math.floor(Math.random() * 200)
})
}
}
// /**
// * @providesModule Counter
// */

// import React from 'react';
// import {
// Text,
// View
// } from 'react-native'

// import styles from './components/theme'
// import Button from './components/button'

// import AnimateNumber from 'react-native-animate-number'

// export default class Counter extends React.Component {
// state = {
// value: 1000
// }

// render() {
// return <View style={styles.container}>
// <AnimateNumber
// interval='10'
// timing='easeIn'
// value={this.state.value}

// style={[styles.customFont, styles.header]}
// formatter={(val) => {
// return parseFloat(val).toFixed(2);
// }}
// />
// <View style={styles.groupButton}>
// <Button onPress={() => this.incrementValue()} theme='dark'>
// Increment
// </Button>
// <Button onPress={() => this.decrementValue()} theme='light'>
// Decrement
// </Button>
// </View>
// <Text style={[styles.customFont, styles.normal]}>Open up main.js to start working on your app!</Text>
// </View>
// }

// decrementValue() {
// this.setState({
// value: this.state.value - Math.floor(Math.random() * 200)
// })
// }

// incrementValue() {
// this.setState({
// value: this.state.value + Math.floor(Math.random() * 200)
// })
// }
// }
Binary file added assets/idea.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"],
};
};
92 changes: 92 additions & 0 deletions components/ProductRow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import React from "react";

import {
View,
Text,
Image,
ScrollView,
StyleSheet,
Dimensions,
Animated,
TouchableWithoutFeedback,
} from "react-native";
import theme from "./theme";

import RenderProductFooter from "./RenderProductFooter";
const { width, height } = Dimensions.get("window");

const ProductRow = ({ product, i, navigation }) => {
console.log(i);

return (
<View style={[theme.container, { width: width, padding: 40 }]} key={i}>
<View
style={{
shadowColor: "#000000",
shadowOpacity: 0.2,
shadowRadius: 3,
shadowOffset: {
height: 0,
width: 0,
},
borderRadius: 4,
alignItems: "center",
justifyContent: "flex-end",
flex: 1,
backgroundColor: "#ffffff",
}}
>
<View style={[theme.newLabel, theme.absoluteTopLeft, theme.greenTheme]}>
<Text style={[theme.newLabelText, theme.customFont]}>NEW</Text>
</View>
<Animated.Image source={{ uri: product.image }} style={[theme.image]} />
<Text style={[theme.customFont, theme.title]}>{product.title}</Text>
<Text style={[theme.customFont, theme.price]}>{product.price}</Text>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
marginVertical: 20,
}}
>
{product.colors.map((color, index) => {
return (
<View
key={index}
style={{
position: "relative",
alignItems: "center",
justifyContent: "center",
}}
>
<View
style={[
theme.productColorBubble,
{
backgroundColor: color,
},
]}
/>
{product.selectedColor === color ? (
<View
style={[
theme.productColorBubble,
theme.selectedBubble,
{
backgroundColor: color,
},
]}
/>
) : null}
</View>
);
})}
</View>

<RenderProductFooter navigation={navigation}/>
</View>
</View>
);
};

export default ProductRow;
31 changes: 31 additions & 0 deletions components/RenderProductFooter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { View } from "react-native";
import Button from "./button";
import theme from "./theme";

export const RenderProductFooter = ({ navigation }) => {
return (
<View
style={[
theme.groupButton,
{
borderBottomLeftRadius: 4,
borderBottomRightRadius: 4,
overflow: "hidden",
borderTopWidth: 1,
borderTopColor: "#f0f0f0",
},
]}
>
<Button onPress={() => console.log("Added to cart")} theme="light">
ADD TO CART
</Button>

<Button onPress={() => navigation.navigate("Checkout")} theme="dark">
BUY NOW
</Button>
</View>
);
};

export default RenderProductFooter;
Loading