Advertisement
Guest User

Untitled

a guest
Sep 13th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1. import React, { useCallback, useEffect, useState } from 'react';
  2. import { observer } from 'mobx-react-lite';
  3. import { StyleSheet, Text, View, Dimensions, Image, TouchableWithoutFeedback } from 'react-native';
  4. import { createStore } from './store/Store';
  5. import StoreContext, { useStore } from './store/StoreContext';
  6. import { configure } from 'mobx';
  7. import { Transition, FluidNavigator } from "react-navigation-fluid-transitions"
  8.  
  9. const store = createStore()
  10. configure({ enforceActions: "always" })
  11.  
  12. export default observer((props: any) => {
  13. const [state, setState] = useState({ isReady: false })
  14.  
  15. const Screen1 = (props) => (
  16. <View style={styles.container}>
  17. <TouchableWithoutFeedback onPress={() => props.navigation.navigate('screen2')}>
  18. <View style={styles.top1}>
  19. <Transition appear="left" shared='paper'>
  20. <View style={styles.paper1} />
  21. </Transition>
  22. <Transition appear="right" shared='image'>
  23. <Image style={styles.shoe1} source={require('../assets/img/shoe.png')} />
  24. </Transition>
  25. <Transition appear="horizontal">
  26. <View style={styles.headerContainer1}>
  27. <Text style={styles.header1}>THE TEN</Text>
  28. <Text style={styles.subHeader1}>AIR JORDAN I</Text>
  29. </View>
  30. </Transition>
  31. </View>
  32. </TouchableWithoutFeedback>
  33. </View>
  34. );
  35.  
  36. const Screen2 = (props) => (
  37. <View style={styles.container}>
  38. <TouchableWithoutFeedback onPress={() => props.navigation.navigate('screen1')}>
  39. <View style={styles.top2}>
  40. <Transition shared='paper'>
  41. <View style={styles.paper2} />
  42. </Transition>
  43. <Transition shared='image'>
  44. <Image style={styles.shoe2} source={require('../assets/img/shoe.png')} />
  45. </Transition>
  46. <Transition appear="horizontal" delay>
  47. <Text style={styles.price}>$ 299</Text>
  48. </Transition>
  49. <View style={styles.smallImageContainer}>
  50. <Transition appear="horizontal" delay>
  51. <View style={styles.smallImageWrapper}>
  52. <Image style={styles.smallImage} source={require('../assets/img/shoe.png')} />
  53. </View>
  54. </Transition>
  55. <Transition appear="horizontal" delay>
  56. <View style={styles.smallImageWrapper}>
  57. <Image style={styles.smallImage} source={require('../assets/img/shoe.png')} />
  58. </View>
  59. </Transition>
  60. </View>
  61. <Transition appear="horizontal">
  62. <View style={styles.headerContainer2}>
  63. <Text style={styles.header2}>THE TEN</Text>
  64. <Text style={styles.subHeader2}>AIR JORDAN I</Text>
  65. </View>
  66. </Transition>
  67. </View>
  68. </TouchableWithoutFeedback>
  69. </View>
  70. );
  71.  
  72.  
  73.  
  74. const Navigator = FluidNavigator({
  75. screen1: { screen: Screen1 },
  76. screen2: { screen: Screen2 },
  77. }, {
  78. style: { backgroundColor: '#C14534' },
  79. defaultNavigationOptions: {
  80. gesturesEnabled: true,
  81. },
  82. });
  83.  
  84. const router = Navigator.router;
  85. const { navigation } = props
  86. return (
  87. <StoreContext.Provider value={store}>
  88. <Navigator navigation={navigation} />
  89. </StoreContext.Provider>
  90. )
  91. })
  92.  
  93.  
  94. const styles = StyleSheet.create({
  95. container: {
  96. flex: 1,
  97. },
  98. top1: {
  99. backgroundColor: '#C14534',
  100. flex: 1,
  101. },
  102. paper1: {
  103. backgroundColor: '#EC806E',
  104. width: Dimensions.get('window').width * 0.65,
  105. height: Dimensions.get('window').height * 0.45,
  106. position: 'absolute',
  107. left: 10,
  108. top: Dimensions.get('window').height * 0.5 - 150,
  109. transform: [{ rotate: '-20deg' }],
  110. alignItems: 'flex-start',
  111. justifyContent: 'flex-end',
  112. shadowColor: '#000',
  113. shadowRadius: 5,
  114. shadowOffset: { width: 0, height: 5 },
  115. shadowOpacity: 0.4,
  116. // elevation: 17,
  117. },
  118. shoe1: {
  119. width: 350,
  120. height: 240,
  121. position: 'absolute',
  122. left: Dimensions.get('window').width * 0.2,
  123. top: Dimensions.get('window').height * 0.5 - 160,
  124. transform: [{ rotate: '35deg' }],
  125. },
  126. headerContainer1: {
  127. padding: 20,
  128. paddingTop: Dimensions.get('window').height * 0.1,
  129. },
  130. header1: {
  131. color: '#FFF',
  132. fontSize: 80,
  133. marginBottom: -14,
  134. },
  135. subHeader1: {
  136. color: '#FFF',
  137. fontSize: 34,
  138. },
  139. top2: {
  140. backgroundColor: '#C14534',
  141. flex: 1,
  142. },
  143. shoe2: {
  144. width: 291,
  145. height: 200,
  146. position: 'absolute',
  147. left: Dimensions.get('window').width * 0.5 - (291 / 2),
  148. top: 60,
  149. },
  150. paper2: {
  151. backgroundColor: '#FFFFFF',
  152. position: 'absolute',
  153. left: 0,
  154. top: Dimensions.get('window').height * 0.5,
  155. bottom: 0,
  156. right: 0,
  157. alignItems: 'center',
  158. justifyContent: 'flex-start',
  159. paddingTop: 70,
  160. padding: 10,
  161. },
  162. price: {
  163. color: '#FFF',
  164. fontSize: 34,
  165. textAlign: 'center',
  166. paddingTop: -55 + Dimensions.get('window').height * 0.5,
  167. },
  168. headerContainer2: {
  169. padding: 20,
  170. justifyContent: 'center',
  171. paddingTop: 50,
  172. },
  173. header2: {
  174. color: '#444',
  175. fontSize: 42,
  176. textAlign: 'center',
  177. marginBottom: -6,
  178. },
  179. subHeader2: {
  180. color: '#444',
  181. fontSize: 22,
  182. textAlign: 'center',
  183. },
  184. smallImageContainer: {
  185. position: 'absolute',
  186. left: 0,
  187. top: Dimensions.get('window').height * 0.54,
  188. bottom: 0,
  189. right: 0,
  190. alignItems: 'center',
  191. paddingTop: 50,
  192. flexDirection: 'row',
  193. justifyContent: 'space-around',
  194. marginLeft: 80,
  195. marginRight: 80,
  196. margin: 30,
  197. },
  198. smallImageWrapper: {
  199. width: Dimensions.get('window').width / 4,
  200. height: Dimensions.get('window').width / 4,
  201. justifyContent: 'center',
  202. alignItems: 'center',
  203. backgroundColor: '#ECECEC',
  204.  
  205. },
  206. smallImage: {
  207. width: 90,
  208. height: 50,
  209. },
  210. });
  211.  
  212.  
  213.  
  214.  
  215. //////////////////////////
  216. package.json
  217. //////////////////////////
  218.  
  219. {
  220. "main": "node_modules/expo/AppEntry.js",
  221. "scripts": {
  222. "start": "expo start",
  223. "android": "expo start --android",
  224. "ios": "expo start --ios",
  225. "web": "expo start --web",
  226. "eject": "expo eject"
  227. },
  228. "dependencies": {
  229. "@microsoft/signalr": "^3.0.0-preview8.19405.7",
  230. "d3": "^5.11.0",
  231. "d3-shape": "^1.3.5",
  232. "expo": "^34.0.4",
  233. "expo-camera": "^6.0.0",
  234. "expo-font": "~6.0.1",
  235. "expo-permissions": "^6.0.0",
  236. "expo-sensors": "~6.0.0",
  237. "lodash": "^4.17.15",
  238. "mobx": "^5.11.0",
  239. "mobx-react-lite": "^1.4.1",
  240. "moment": "^2.24.0",
  241. "native-base": "^2.13.7",
  242. "react": "16.8.3",
  243. "react-dom": "^16.8.6",
  244. "react-icons": "^3.7.0",
  245. "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
  246. "react-native-elements": "^1.1.0",
  247. "react-native-fusioncharts": "^4.0.0",
  248. "react-native-gesture-handler": "^1.4.1",
  249. "react-native-image-picker": "^1.0.1",
  250. "react-native-reanimated": "~1.1.0",
  251. "react-native-screens": "1.0.0-alpha.22",
  252. "react-native-svg": "~9.5.1",
  253. "react-native-svg-charts": "^5.3.0",
  254. "react-native-vector-icons": "^6.6.0",
  255. "react-native-waveview": "^1.1.0",
  256. "react-native-web": "^0.11.4",
  257. "react-navigation": "^1.7.0",
  258. "react-navigation-fluid-transitions": "^0.1.7",
  259. "victory-native": "^33.0.0"
  260. },
  261. "devDependencies": {
  262. "@babel/plugin-proposal-class-properties": "^7.5.0",
  263. "@babel/plugin-proposal-decorators": "^7.4.4",
  264. "@babel/preset-typescript": "^7.3.3",
  265. "@types/react-native": "^0.60.0",
  266. "@types/signalr": "^2.2.35",
  267. "babel-preset-expo": "^5.1.1"
  268. },
  269. "private": true
  270. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement