diff --git a/App/Screens/ErrorScreen/ErrorScreen.tsx b/App/Screens/ErrorScreen/ErrorScreen.tsx
index ac1c93ec..1b2b452b 100644
--- a/App/Screens/ErrorScreen/ErrorScreen.tsx
+++ b/App/Screens/ErrorScreen/ErrorScreen.tsx
@@ -15,7 +15,7 @@
// along with Sh**t! I Smoke. If not, see .
import React, { useContext } from 'react';
-import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
+import { Image, StyleSheet, Text, View } from 'react-native';
import { NavigationInjectedProps } from 'react-navigation';
import { scale } from 'react-native-size-matters';
@@ -41,13 +41,13 @@ export function ErrorScreen (props: ErrorScreenProps) {
{i18n.t('error_screen_error_cannot_load_cigarettes')}
- props.navigation.navigate('Search')}>
-
-
-
-
+
{i18n.t('error_screen_error_description')}
{i18n.t('error_screen_error_message', { errorText: error })}
diff --git a/App/Screens/Search/GpsItem/GpsItem.tsx b/App/Screens/Search/GpsItem/GpsItem.tsx
index 13290178..2c18c04f 100644
--- a/App/Screens/Search/GpsItem/GpsItem.tsx
+++ b/App/Screens/Search/GpsItem/GpsItem.tsx
@@ -26,6 +26,10 @@ export function GpsItem () {
const { setCurrentLocation } = useContext(CurrentLocationContext);
const gps = useContext(GpsLocationContext);
+ if (!gps) {
+ return null;
+ }
+
const handleClick = () => {
setCurrentLocation(gps);
};
@@ -35,7 +39,7 @@ export function GpsItem () {
description={i18n.t('search_current_location')}
icon="gps"
onPress={handleClick}
- title={gps!.name || LOADING_TEXT}
+ title={gps.name || LOADING_TEXT}
/>
);
}
diff --git a/App/Screens/Search/Search.tsx b/App/Screens/Search/Search.tsx
index 0fbf30bb..7d4af11d 100644
--- a/App/Screens/Search/Search.tsx
+++ b/App/Screens/Search/Search.tsx
@@ -27,11 +27,7 @@ import { AlgoliaHit, fetchAlgolia } from './fetchAlgolia';
import { AlgoliaItem } from './AlgoliaItem';
import { GpsItem } from './GpsItem';
import { SearchHeader } from './SearchHeader';
-import {
- CurrentLocationContext,
- ErrorContext,
- GpsLocationContext
-} from '../../stores';
+import { CurrentLocationContext, GpsLocationContext } from '../../stores';
import { Location } from '../../stores/fetchGpsPosition';
import { logFpError } from '../../util/fp';
import * as theme from '../../util/theme';
@@ -43,7 +39,6 @@ interface SearchProps extends NavigationInjectedProps {}
export function Search (props: SearchProps) {
const { isGps, setCurrentLocation } = useContext(CurrentLocationContext);
- const { setError } = useContext(ErrorContext);
const gps = useContext(GpsLocationContext);
const [algoliaError, setAlgoliaError] = useState(
@@ -92,9 +87,7 @@ export function Search (props: SearchProps) {
}
function handleItemClick (item: Location) {
- // Reset everything when we choose a new location.
setCurrentLocation(item);
- setError(undefined);
}
function renderItem ({ item }: { item: AlgoliaHit }) {
diff --git a/App/components/BoxButton/BoxButton.tsx b/App/components/BoxButton/BoxButton.tsx
index f5c44f3b..c10014b9 100644
--- a/App/components/BoxButton/BoxButton.tsx
+++ b/App/components/BoxButton/BoxButton.tsx
@@ -52,14 +52,15 @@ const styles = StyleSheet.create({
opacity: 1
},
boxButton: {
+ ...theme.elevationShadowStyle(3),
backgroundColor: 'white',
borderColor: 'rgba(0, 0, 0, 0.1)',
borderRadius: scale(12),
borderWidth: 1,
marginBottom: theme.spacing.tiny,
paddingHorizontal: theme.spacing.small,
- paddingVertical: scale(4),
- ...theme.elevationShadowStyle(5)
+ paddingVertical: scale(4), // Padding for the shadow
+ shadowOpacity: 0.1
},
boxButtonText: {
...theme.shitText,
diff --git a/App/components/Button/Button.tsx b/App/components/Button/Button.tsx
index 6e7e0001..ef26b9bf 100644
--- a/App/components/Button/Button.tsx
+++ b/App/components/Button/Button.tsx
@@ -33,7 +33,7 @@ interface ButtonProps extends TouchableOpacityProps {
}
export function Button (props: ButtonProps) {
- const { children, icon, onPress, type, ...rest } = props;
+ const { children, icon, onPress, style, type, ...rest } = props;
return (
diff --git a/App/stores/api.tsx b/App/stores/api.tsx
index c04cc008..d6162781 100644
--- a/App/stores/api.tsx
+++ b/App/stores/api.tsx
@@ -45,6 +45,7 @@ export function ApiContextProvider ({ children }: ApiContextProviderProps) {
useEffect(() => {
setApi(undefined);
+ setError(undefined);
if (!currentLocation) {
return;
diff --git a/App/util/theme.ts b/App/util/theme.ts
index b972a13d..092a04ab 100644
--- a/App/util/theme.ts
+++ b/App/util/theme.ts
@@ -61,7 +61,7 @@ export function elevationShadowStyle (
shadowColor: 'black',
shadowOffset: {
width: 0,
- height: scale((position === 'bottom' ? 1 : -1) * 0.5 * elevation)
+ height: scale((position === 'bottom' ? 1 : -1) * elevation)
},
shadowOpacity: 0.3,
shadowRadius: scale(0.8 * elevation)