diff --git a/android/.gradle/7.5.1/executionHistory/executionHistory.bin b/android/.gradle/7.5.1/executionHistory/executionHistory.bin index 9b2a2880..57f6ca4b 100644 Binary files a/android/.gradle/7.5.1/executionHistory/executionHistory.bin and b/android/.gradle/7.5.1/executionHistory/executionHistory.bin differ diff --git a/android/.gradle/7.5.1/executionHistory/executionHistory.lock b/android/.gradle/7.5.1/executionHistory/executionHistory.lock index 28822c9b..08651f3c 100644 Binary files a/android/.gradle/7.5.1/executionHistory/executionHistory.lock and b/android/.gradle/7.5.1/executionHistory/executionHistory.lock differ diff --git a/android/.gradle/7.5.1/fileHashes/fileHashes.bin b/android/.gradle/7.5.1/fileHashes/fileHashes.bin index b009f899..a450498e 100644 Binary files a/android/.gradle/7.5.1/fileHashes/fileHashes.bin and b/android/.gradle/7.5.1/fileHashes/fileHashes.bin differ diff --git a/android/.gradle/7.5.1/fileHashes/fileHashes.lock b/android/.gradle/7.5.1/fileHashes/fileHashes.lock index cacdf7f8..7b2d5f23 100644 Binary files a/android/.gradle/7.5.1/fileHashes/fileHashes.lock and b/android/.gradle/7.5.1/fileHashes/fileHashes.lock differ diff --git a/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 42655328..7c54eef0 100644 Binary files a/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/android/.gradle/file-system.probe b/android/.gradle/file-system.probe index 85000b7b..d8b24831 100644 Binary files a/android/.gradle/file-system.probe and b/android/.gradle/file-system.probe differ diff --git a/app/screens/account/index.js b/app/screens/account/index.js index 4b6fc52a..ddd7f355 100644 --- a/app/screens/account/index.js +++ b/app/screens/account/index.js @@ -192,6 +192,7 @@ class About extends React.PureComponent { @@ -262,6 +263,7 @@ class About extends React.PureComponent { Unioil Logo @@ -271,6 +273,7 @@ class About extends React.PureComponent { diff --git a/app/screens/main/station/fragments/bottomsheet.js b/app/screens/main/station/fragments/bottomsheet.js index bc3fabe8..c3bb9946 100644 --- a/app/screens/main/station/fragments/bottomsheet.js +++ b/app/screens/main/station/fragments/bottomsheet.js @@ -92,15 +92,14 @@ const updateFavorite = async (city, index, callback) => { export default function renderStationPanel(props) { - const [updatedFavorite, setupdatedfavorite] = useState(false) - const [updatedFavoriteIndex, setupdatedfavoriteindex] = useState(null) const bottomSheetRef = useRef(null); + const snapPoints = [450, 300, 0]; useEffect(() => { if (props.visible) { bottomSheetRef.current?.expand(); } else { - bottomSheetRef.current?.close(); + bottomSheetRef.current?.collapse(); } }, [props.visible]); @@ -108,10 +107,11 @@ export default function renderStationPanel(props) { + {renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite)} @@ -125,7 +125,6 @@ export default function renderStationPanel(props) { - {renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite)} ) diff --git a/app/screens/main/station/fragments/map.js b/app/screens/main/station/fragments/map.js index 6f4a1ebc..ef055818 100644 --- a/app/screens/main/station/fragments/map.js +++ b/app/screens/main/station/fragments/map.js @@ -33,8 +33,8 @@ export default function RenderMap(props){ return ( { const [updateFavorite, setUpdateFavorite] = useState(0) const [updateFavoriteVal, setUpdateFavoriteVal] = useState(false) const bottomSheetRef = useRef(null); + const snapPoints = ['40%']; useEffect(() => { if (props.visible) { - bottomSheetRef.current?.expand(); + bottomSheetRef.current?.expand(); } else { - bottomSheetRef.current?.close(); + bottomSheetRef.current?.collapse(); } }, [props.visible]); @@ -180,13 +181,14 @@ const renderStationPanel = (props) => { } return ( - + // + {renderStationDetails(props.data, props.onClick)} @@ -215,9 +217,8 @@ const renderStationPanel = (props) => { - {renderStationDetails(props.data, props.onClick)} - + // ); } diff --git a/app/screens/main/station/fragments/stationpanel.js b/app/screens/main/station/fragments/stationpanel.js index b488574c..b106df5b 100644 --- a/app/screens/main/station/fragments/stationpanel.js +++ b/app/screens/main/station/fragments/stationpanel.js @@ -1,5 +1,5 @@ import React from 'react'; -import {useState, useEffect, useRef} from 'react'; +import { useState, useEffect, useRef } from 'react'; import { Text, View, @@ -39,7 +39,7 @@ const styles = { }, }; -const {height} = Dimensions.get('window'); +const { height } = Dimensions.get('window'); const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { return data.map((station, index) => { @@ -49,9 +49,10 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { return ( ); }); @@ -60,10 +61,10 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { key={index} activeOpacity={1} onPress={() => onPress(station) || null} - style={{backgroundColor: props.app_theme?.theme.dark ? Theme.colors.black : Theme.colors.white}} - > - - + style={{ backgroundColor: props.app_theme?.theme.dark ? Theme.colors.black : Theme.colors.white }} + > + + { }}> {station.address} - {stars} + {stars} { - if(isGuest){ + if (isGuest) { guestError() } else { updateFavorite(station, index, onUpdateFavorite) } }} - style={{flex: 0, justifyContent: 'center'}}> + style={{ flex: 0, justifyContent: 'center' }}> { ); @@ -109,19 +110,19 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => { const guestError = () => { Alert.alert( - "Information", + "Information", `\nApply for a card to enjoy this feature`, - [ - { - text: 'Cancel', - onPress: () => console.log('Cancel Pressed'), - style: { color: 'red' }, - }, + [ { - text: 'Enroll Card', - onPress: () => navigate('Login') - }, - ] + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: { color: 'red' }, + }, + { + text: 'Enroll Card', + onPress: () => navigate('Login') + }, + ] ); } @@ -148,16 +149,11 @@ const updateFavorite = async (city, index, callback) => { }; const renderStationPanel = (props) => { - const [snap, setSnap] = useState(['10%', '10%', '3%']); - const bottomSheetRef = useRef(null); + const [snap, setSnap] = useState(['10%', '10%', '3%']); + const bottomSheetRef = useRef(null); useEffect(() => { init(); - if (props.visible) { - bottomSheetRef.current?.expand(); - } else { - bottomSheetRef.current?.close(); - } }, [props.visible, props.data]); const init = () => { @@ -177,79 +173,62 @@ const renderStationPanel = (props) => { }; const getPanelTitle = () => { - if(props.error) return 'There was an error' - else if(props.loading && !props.isSearched && props.data.length == 0) return 'Getting Nearby Stations' - else if(!props.loading && props.isFavorite && props.data.length == 0) return 'No Favorite' - else if(props.isSearched) return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) + if (props.error) return 'There was an error' + else if (props.loading && !props.isSearched && props.data.length == 0) return 'Getting Nearby Stations' + else if (!props.loading && props.isFavorite && props.data.length == 0) return 'No Favorite' + else if (props.isSearched) return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) else return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) } - const renderHeaders = () => ( - - - - - {getPanelTitle()} - - - {props.error ? ( - - Try Again - - ) : props.loading ? ( - - ) : null} - + const renderHeaders = () => { + return ( + + + + {getPanelTitle()} + + + {props.error ? ( + + Try Again + + ) : props.loading ? ( + + ) : null} ); + }; - const renderContents = () => ( - - - {props.data.length > 0 ? ( - renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite, props) - ) : ( - - )} - - + const renderContents = () => { + return ( + + {props.data.length > 0 ? renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite, props) : + } + ); + }; return ( - + // - {renderHeaders()} - {renderContents()} + + {renderHeaders()} + {renderContents()} + - + // ); } diff --git a/app/screens/payatpump/fragments/stationpanel.js b/app/screens/payatpump/fragments/stationpanel.js index 17599e68..62903a06 100644 --- a/app/screens/payatpump/fragments/stationpanel.js +++ b/app/screens/payatpump/fragments/stationpanel.js @@ -103,37 +103,41 @@ const updateFavorite = async (city, index, callback) => { }; const renderStationPanel = (props) => { - const [panel, setpanel] = useState(null); - const [updatedFavorite, setupdatedfavorite] = useState(false); - const [updatedFavoriteIndex, setupdatedfavoriteindex] = useState(null); - const [loading, setLoading] = useState(false); - const [snap, setSnap] = useState(['10%', '10%', '3%']); + const [snap, setSnap] = useState(['10%', '10%', '3%']); const bottomSheetRef = useRef(null); + const [initialSnap, setInitialSnap] = useState(0) useEffect(() => { init(); - if (props.visible) { - bottomSheetRef.current?.expand(); - } else { - bottomSheetRef.current?.close(); - } }, [props.visible, props.data.length]); + const init = () => { - if (props.visible == true || props.data.length !== 0) { + if (props.visible == true) { if (props.data.length === 1) { setSnap([Platform.OS === "android" ? '23%' : '16%', '8%', '8%']); } else if (props.data.length === 2) { setSnap([Platform.OS === "android" ? '39%' : '27%', '8%', '8%']); + setInitialSnap(0); } else { setSnap(['38%', '8%', '8%']); + setInitialSnap(0); + } + } else if (props.data.length != 0) { + if (props.data.length === 1) { + setSnap([Platform.OS === "android" ? '23%' : '16%', '8%', '8%']); + } else if (props.data.length === 2) { + setSnap([Platform.OS === "android" ? '39%' : '27%', '8%', '8%']); + setInitialSnap(0); + } else { + setSnap(['38%', '8%', '8%']); + setInitialSnap(0); } - } else { setSnap([Platform.select({ ios: '14%', android: '12%' }), '8%', '8%']); + setInitialSnap(2); } }; - const getPanelTitle = () => { if (props.error) return 'There was an error' else if (props.loading && !props.isSearched && props.data.length == 0) return 'Getting Nearby Stations' @@ -142,22 +146,16 @@ const renderStationPanel = (props) => { else return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0) } - const renderHeaders = () => ( - + const renderHeaders = () => { + return ( - + - {getPanelTitle()} @@ -171,42 +169,29 @@ const renderStationPanel = (props) => { - - ); - - - const renderContents = () => ( - - {props.data.length > 0 ? ( - renderStations(props.data, props.onClick, props.onUpdateFavorite, props) - ) : ( - - - - )} - - ); + ); + }; + const renderContents = () => { + return ( + + {props.data.length > 0 ? renderStations(props.data, props.onClick, props.onUpdateFavorite, props) : + } + + ); + }; return ( - {renderHeaders()} - {renderContents()} + + {renderHeaders()} + {renderContents()} + ); } diff --git a/index.js b/index.js index 20425b2c..6da7a073 100644 --- a/index.js +++ b/index.js @@ -6,11 +6,13 @@ import './polyfills.js'; import 'react-native-gesture-handler'; import 'react-native-reanimated'; -import { AppRegistry } from 'react-native'; +import { AppRegistry, LogBox } from 'react-native'; import App from './app/App'; import { name as appName } from './app.json'; import messaging from '@react-native-firebase/messaging'; +LogBox.ignoreLogs(['`new NativeEventEmitter()`']); + messaging().setBackgroundMessageHandler(async remoteMessage => { console.log("'Message handled in the background!'", remoteMessage); });