From 3c9204df3ca8e06dfb822af6a2baadc4581eaaba Mon Sep 17 00:00:00 2001 From: Antonio Sousa Date: Sat, 18 Jul 2020 13:18:51 -0300 Subject: [PATCH 1/2] chore: remove eslint config unecessary --- .eslintrc.js | 4 ---- package.json | 1 - 2 files changed, 5 deletions(-) delete mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 40c6dcd..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: '@react-native-community', -}; diff --git a/package.json b/package.json index 65d7faf..7aba917 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "devDependencies": { "@babel/core": "^7.8.7", "@babel/runtime": "^7.8.7", - "@react-native-community/eslint-config": "^0.0.7", "babel-eslint": "^10.1.0", "babel-jest": "^25.1.0", "babel-plugin-root-import": "^6.4.1", From 0997c9c6225f0c553c99be01159207d3cfaa9134 Mon Sep 17 00:00:00 2001 From: Antonio Sousa Date: Sat, 18 Jul 2020 13:49:15 -0300 Subject: [PATCH 2/2] style: fix problems pointed by Eslint --- src/components/ForecastDetails/index.js | 20 ++++++++++++-------- src/components/ForecastDetails/styles.js | 2 +- src/config/ReactotronConfig.js | 1 + src/pages/Main/index.js | 14 +++++++------- src/routes.js | 4 ++-- src/services/api.js | 5 +++-- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/components/ForecastDetails/index.js b/src/components/ForecastDetails/index.js index a214d22..f04fc03 100644 --- a/src/components/ForecastDetails/index.js +++ b/src/components/ForecastDetails/index.js @@ -1,6 +1,6 @@ import React from 'react'; -import {Animated} from 'react-native'; -import {PanGestureHandler, State} from 'react-native-gesture-handler'; +import { Animated } from 'react-native'; +import { PanGestureHandler, State } from 'react-native-gesture-handler'; import LottieView from 'lottie-react-native'; import LottieAnimationJson from '~/assets/lottie-animations/sunny.json'; @@ -33,12 +33,12 @@ export default function ForecastDetails() { }, }, ], - {useNativeDriver: true}, + { useNativeDriver: true }, ); function onHandlerStateChanged(event) { if (event.nativeEvent.oldState === State.ACTIVE) { - const {translationY} = event.nativeEvent; + const { translationY } = event.nativeEvent; let opened = false; offset += translationY; @@ -65,7 +65,8 @@ export default function ForecastDetails() { return ( + onHandlerStateChange={onHandlerStateChanged} + > + }} + >
+ }} + > Vreeland
+ }} + > M7º / L5º diff --git a/src/components/ForecastDetails/styles.js b/src/components/ForecastDetails/styles.js index 5b0b9da..ac5e965 100644 --- a/src/components/ForecastDetails/styles.js +++ b/src/components/ForecastDetails/styles.js @@ -1,4 +1,4 @@ -import {Animated} from 'react-native'; +import { Animated } from 'react-native'; import styled from 'styled-components/native'; export const Card = styled(Animated.View)` diff --git a/src/config/ReactotronConfig.js b/src/config/ReactotronConfig.js index c4eb683..c807108 100644 --- a/src/config/ReactotronConfig.js +++ b/src/config/ReactotronConfig.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import Reactotron from 'reactotron-react-native'; if (__DEV__) { diff --git a/src/pages/Main/index.js b/src/pages/Main/index.js index 7a5fc36..8aced10 100644 --- a/src/pages/Main/index.js +++ b/src/pages/Main/index.js @@ -1,10 +1,10 @@ -import React, {useEffect, useState} from 'react'; +import React, { useEffect, useState } from 'react'; -import {View, StyleSheet} from 'react-native'; -import ForecastDetails from '~/components/ForecastDetails'; +import { StyleSheet } from 'react-native'; import MapView from 'react-native-maps'; -import {SafeAreaView} from 'react-navigation'; +import { SafeAreaView } from 'react-navigation'; import RNLocation from 'react-native-location'; +import ForecastDetails from '~/components/ForecastDetails'; const styles = StyleSheet.create({ container: { @@ -32,9 +32,9 @@ const Main = () => { }); if (granted) { - RNLocation.subscribeToLocationUpdates(locations => { + RNLocation.subscribeToLocationUpdates((locations) => { if (locations.length > 0) { - const {latitude, longitude} = locations[0]; + const { latitude, longitude } = locations[0]; setCurrentRegion({ latitude, longitude, @@ -54,7 +54,7 @@ const Main = () => { {currentRegion.latitude && ( )} diff --git a/src/routes.js b/src/routes.js index 9d790ab..49f937a 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1,7 +1,7 @@ -import {createAppContainer, createSwitchNavigator} from 'react-navigation'; +import { createAppContainer, createSwitchNavigator } from 'react-navigation'; import Main from '~/pages/Main'; -const Routes = createAppContainer(createSwitchNavigator({Main})); +const Routes = createAppContainer(createSwitchNavigator({ Main })); export default Routes; diff --git a/src/services/api.js b/src/services/api.js index 8699f75..1dc5819 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -1,12 +1,13 @@ import axios from 'axios'; -import {OPEN_WEATHER_MAP_APP_ID} from 'react-native-dotenv'; +import { OPEN_WEATHER_MAP_APP_ID } from 'react-native-dotenv'; const api = axios.create({ baseURL: 'https://api.openweathermap.org/data/2.5/', }); -api.interceptors.request.use(config => { +api.interceptors.request.use((defaultConfig) => { + const config = defaultConfig; config.params = config.params || {}; config.params.APPID = OPEN_WEATHER_MAP_APP_ID;