├── .expo-shared └── assets.json ├── .gitignore ├── .idea ├── .gitignore ├── misc.xml ├── modules.xml ├── reactNativeApp.iml └── vcs.xml ├── App.js ├── app.json ├── assets ├── icon.png └── splash.png ├── babel.config.js ├── package-lock.json ├── package.json └── src ├── actions └── device.js ├── components ├── deviceList │ ├── Device.jsx │ └── DeviceList.jsx └── navbar │ └── Navbar.jsx └── reducers ├── deviceReducer.js └── index.js /.expo-shared/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, 3 | "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | .expo/* 3 | npm-debug.* 4 | *.jks 5 | *.p8 6 | *.p12 7 | *.key 8 | *.mobileprovision 9 | *.orig.* 10 | web-build/ 11 | web-report/ 12 | 13 | # macOS 14 | .DS_Store 15 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Default ignored files 3 | /workspace.xml -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/reactNativeApp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | import {applyMiddleware, createStore} from "redux"; 4 | import reducer from './src/reducers/index' 5 | import {composeWithDevTools} from "redux-devtools-extension"; 6 | import thunk from "redux-thunk"; 7 | import {Provider} from "react-redux"; 8 | import Navbar from "./src/components/navbar/Navbar"; 9 | import DeviceList from "./src/components/deviceList/DeviceList"; 10 | 11 | const store = createStore(reducer, composeWithDevTools(applyMiddleware(thunk))) 12 | 13 | 14 | export default function App() { 15 | return ( 16 | 17 | 18 | 19 | 20 | 21 | 22 | ); 23 | } 24 | 25 | const styles = StyleSheet.create({ 26 | container: { 27 | flex: 1, 28 | backgroundColor: '#fff', 29 | alignItems: 'flex-start', 30 | justifyContent: 'flex-start', 31 | width:"100%" 32 | }, 33 | text: { 34 | color:"black" 35 | } 36 | }); 37 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "reactNativeApp", 4 | "slug": "reactNativeApp", 5 | "platforms": [ 6 | "ios", 7 | "android", 8 | "web" 9 | ], 10 | "version": "1.0.0", 11 | "orientation": "portrait", 12 | "icon": "./assets/icon.png", 13 | "splash": { 14 | "image": "./assets/splash.png", 15 | "resizeMode": "contain", 16 | "backgroundColor": "#ffffff" 17 | }, 18 | "updates": { 19 | "fallbackToCacheTimeout": 0 20 | }, 21 | "assetBundlePatterns": [ 22 | "**/*" 23 | ], 24 | "ios": { 25 | "supportsTablet": true 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utimur/ReactNativeElectronicStore/5d51b7a83b03a7e6f37ae3cc0fc40c800b3a5f0c/assets/icon.png -------------------------------------------------------------------------------- /assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utimur/ReactNativeElectronicStore/5d51b7a83b03a7e6f37ae3cc0fc40c800b3a5f0c/assets/splash.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | api.cache(true); 3 | return { 4 | presets: ['babel-preset-expo'], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "node_modules/expo/AppEntry.js", 3 | "scripts": { 4 | "start": "expo start", 5 | "android": "expo start --android", 6 | "ios": "expo start --ios", 7 | "web": "expo start --web", 8 | "eject": "expo eject" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.19.2", 12 | "expo": "~37.0.3", 13 | "react": "~16.9.0", 14 | "react-dom": "~16.9.0", 15 | "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz", 16 | "react-native-web": "~0.11.7", 17 | "react-redux": "^7.2.0", 18 | "redux": "^4.0.5", 19 | "redux-devtools-extension": "^2.13.8", 20 | "redux-thunk": "^2.3.0" 21 | }, 22 | "devDependencies": { 23 | "babel-preset-expo": "~8.1.0", 24 | "@babel/core": "^7.8.6" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /src/actions/device.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import {setDevices} from "../reducers/deviceReducer"; 3 | 4 | const IP_ADDRESS = "192.168.0.13:8080" 5 | export const getDevices = () => { 6 | return async (dispatch) => { 7 | try { 8 | const response = await axios.get(`http://${IP_ADDRESS}/api/v1/devices/pagination`) 9 | dispatch(setDevices(response.data.devices)) 10 | } catch (e) { 11 | console.log("ERROR") 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/components/deviceList/Device.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {View, Text, StyleSheet, Image} from 'react-native' 3 | 4 | const Device = ({device}) => { 5 | 6 | return ( 7 | 8 | 13 | 14 | 15 | {device.brandName} 16 | {device.name} 17 | 18 | 19 | {device.price} 20 | 21 | 22 | 23 | ); 24 | }; 25 | 26 | export default Device; 27 | 28 | const styles = StyleSheet.create({ 29 | container:{ 30 | flexDirection: "row", 31 | marginTop:10 32 | }, 33 | text: { 34 | color:"black", 35 | fontSize: 20 36 | }, 37 | logo: { 38 | marginLeft:5, 39 | height:50, 40 | width:50, 41 | marginRight:20, 42 | borderWidth:1, 43 | borderColor:"black", 44 | borderRadius:50, 45 | 46 | }, 47 | desc:{ 48 | flexDirection: "row", 49 | justifyContent:"space-between", 50 | 51 | }, 52 | 53 | }) 54 | 55 | -------------------------------------------------------------------------------- /src/components/deviceList/DeviceList.jsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect} from 'react'; 2 | import {ScrollView, StyleSheet} from "react-native"; 3 | import {useDispatch, useSelector} from "react-redux"; 4 | import Device from "./Device"; 5 | import {getDevices} from "../../actions/device"; 6 | 7 | const DeviceList = () => { 8 | const dispatch = useDispatch() 9 | const devices = useSelector(state => state.deviceReducer.devices) 10 | 11 | useEffect(()=>{ 12 | dispatch(getDevices()) 13 | }, []) 14 | 15 | return ( 16 | 17 | {devices.map(device=> 18 | 19 | )} 20 | 21 | ); 22 | }; 23 | 24 | export default DeviceList; 25 | 26 | -------------------------------------------------------------------------------- /src/components/navbar/Navbar.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {View, StyleSheet, Text, Button} from "react-native" 3 | 4 | const Navbar = (props) => { 5 | return ( 6 | 7 | Device Store 8 |