bug fixes

This commit is contained in:
nnajah1 2025-04-14 17:56:25 +08:00
parent e51dd59e5f
commit 7951014d96
13 changed files with 128 additions and 159 deletions

Binary file not shown.

View File

@ -192,6 +192,7 @@ class About extends React.PureComponent {
<NBImage
style={{height: 50, width: 50, marginRight: 10, borderRadius: 25}}
source={account.data ? account.data.photo == '' ? Assets.logo.profileHolder : {uri: account.data.photo} : Assets.logo.profileHolder}
alt="Profile Photo"
/>
</View>
<View style={{flex: 3, justifyContent: 'center'}}>
@ -262,6 +263,7 @@ class About extends React.PureComponent {
<Image
source={Assets.logo.unioil}
style={{width: '100%', height: '85%', resizeMode: 'contain'}}
alt="Unioil Logo"
/>
</View>
<View style={{flex: 1}}>
@ -271,6 +273,7 @@ class About extends React.PureComponent {
<NBImage
style={{height: 50, width: 50, marginRight: 10, borderRadius: 25}}
source={this.state.data ? this.state.data.photo == '' ? Assets.logo.profileHolder : {uri: this.state.data.photo} : Assets.logo.profileHolder}
alt="Profile Photo"
/>
</View>
<View style={{flex: 3, justifyContent: 'center'}}>

View File

@ -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) {
<View style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
snapPoints={['50%', '30%', '0%']}
snapPoints={snapPoints}
enablePanDownToClose={true}
index={props.visible ? 1 : -1}
index={-1}
>
{renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite)}
<View style={styles.panelHeader}>
<View style={{ flexDirection: 'row', justifyContent: 'center', padding: 15 }}>
<Text style={{ flex: 4, padding: 5, color: Theme.colors.textPrimary, fontSize: 15 }}>
@ -125,7 +125,6 @@ export default function renderStationPanel(props) {
</View>
</View>
</View>
{renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite)}
</BottomSheet>
</View >
)

View File

@ -33,8 +33,8 @@ export default function RenderMap(props){
return (
<MapView
ref={props.getRef}
// provider={PROVIDER_GOOGLE}
provider={null}
provider={PROVIDER_GOOGLE}
// provider={null}
loadingEnabled={true}
style={styles.map}
showsUserLocation={true}

View File

@ -47,12 +47,13 @@ const renderStationPanel = (props) => {
const [updateFavorite, setUpdateFavorite] = useState(0)
const [updateFavoriteVal, setUpdateFavoriteVal] = useState(false)
const bottomSheetRef = useRef(null);
const snapPoints = ['40%'];
useEffect(() => {
if (props.visible) {
bottomSheetRef.current?.expand();
} else {
bottomSheetRef.current?.close();
bottomSheetRef.current?.collapse();
}
}, [props.visible]);
@ -180,13 +181,14 @@ const renderStationPanel = (props) => {
}
return (
<View style={{ flex: 1 }}>
// <View style={{ flex: 1 }}>
<BottomSheet
ref={bottomSheetRef}
snapPoints={['70%', '40%', '0%']}
index={-1}
snapPoints={snapPoints}
enablePanDownToClose={true}
enableContentPanningGesture={true}
>
{renderStationDetails(props.data, props.onClick)}
<View style={[styles.panelHeader, { backgroundColor: props.app_theme?.theme.dark ? Theme.colors.darkerGray : Theme.colors.lightGray }]}>
<View style={{ flexDirection: 'row', justifyContent: 'center', padding: 15 }}>
<Text numberOfLines={1} style={{ flex: 1, paddingRight: 40, paddingTop: 17, justifyContent: 'center', color: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.text : Theme.colors.darkGray, fontSize: 16, fontWeight: 'bold' }}>
@ -215,9 +217,8 @@ const renderStationPanel = (props) => {
</View>
</View>
</View>
{renderStationDetails(props.data, props.onClick)}
</BottomSheet>
</View>
// </View>
);
}

View File

@ -52,6 +52,7 @@ const renderStations = (isGuest, data, onPress, onUpdateFavorite, props) => {
style={{ marginLeft: mgn }}
color={Theme.colors.yellow}
size={20}
key={i}
/>
);
});
@ -153,11 +154,6 @@ const renderStationPanel = (props) => {
useEffect(() => {
init();
if (props.visible) {
bottomSheetRef.current?.expand();
} else {
bottomSheetRef.current?.close();
}
}, [props.visible, props.data]);
const init = () => {
@ -184,17 +180,11 @@ const renderStationPanel = (props) => {
else return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0)
}
const renderHeaders = () => (
<View style={styles.panel}>
const renderHeaders = () => {
return (
<View style={[styles.panelHeader, { backgroundColor: props.app_theme?.theme.dark ? Theme.colors.darkerGray : Theme.colors.lightGray }]}>
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
padding: 15,
}}>
<Text
style={{
<View style={{ flexDirection: 'row', justifyContent: 'center', padding: 15 }}>
<Text style={{
flex: 4,
padding: 5,
color: props.app_theme?.theme.colors.text,
@ -213,43 +203,32 @@ const renderStationPanel = (props) => {
</View>
</View>
</View>
</View>
);
};
const renderContents = () => (
<BottomSheetScrollView
style={{
backgroundColor: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.border : Theme.colors.white,
}}
>
const renderContents = () => {
return (
<SafeAreaView>
{props.data.length > 0 ? (
renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite, props)
) : (
<View
style={{
height: 250,
width: '100%',
backgroundColor: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.border : Theme.colors.white,
}}
/>
)}
{props.data.length > 0 ? renderStations(props.isGuest, props.data, props.onClick, props.onUpdateFavorite, props) :
<View style={{ height: 250, width: '100%', backgroundColor: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.border : Theme.colors.white }}></View>}
</SafeAreaView>
</BottomSheetScrollView>
);
};
return (
<View style={{ flex: 1 }}>
// <View style={{ flex: 1 }}>
<BottomSheet
ref={bottomSheetRef}
snapPoints={snap}
enablePanDownToClose={true}
index={props.visible ? 1 : -1}
index={-1}
>
<View>
{renderHeaders()}
{renderContents()}
</BottomSheet>
</View>
</BottomSheet>
// </View>
);
}

View File

@ -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 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,17 +146,11 @@ const renderStationPanel = (props) => {
else return 'Unioil Stations found: ' + (props.data.length > 0 ? props.data.length : 0)
}
const renderHeaders = () => (
<View style={styles.panel}>
const renderHeaders = () => {
return (
<View style={[styles.panelHeader, { backgroundColor: props.app_theme?.theme.dark ? Theme.colors.darkGray : Theme.colors.lightGray }]}>
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
padding: 15,
}}>
<Text
style={{
<View style={{ flexDirection: 'row', justifyContent: 'center', padding: 15 }}>
<Text style={{
flex: 4,
padding: 5,
color: props.app_theme?.theme.colors.text,
@ -171,42 +169,29 @@ const renderStationPanel = (props) => {
</View>
</View>
</View>
</View>
);
};
const renderContents = () => (
<BottomSheetScrollView
style={{
backgroundColor: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.border : Theme.colors.white,
}}
>
{props.data.length > 0 ? (
renderStations(props.data, props.onClick, props.onUpdateFavorite, props)
) : (
<View
style={{
height: 250,
width: '100%',
backgroundColor: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.border : Theme.colors.white,
}}
>
<View />
</View>
)}
</BottomSheetScrollView>
const renderContents = () => {
return (
<SafeAreaView style={props.data.length < 3 && { height: '100%', backgroundColor: 'white' }}>
{props.data.length > 0 ? renderStations(props.data, props.onClick, props.onUpdateFavorite, props) :
<View style={{ height: 250, width: '100%', backgroundColor: props.app_theme?.theme.dark ? props.app_theme?.theme.colors.border : Theme.colors.white }}></View>}
</SafeAreaView>
);
};
return (
<BottomSheet
ref={bottomSheetRef}
snapPoints={snap}
enablePanDownToClose={true}
index={props.visible ? 1 : -1}
index={initialSnap}
>
<View>
{renderHeaders()}
{renderContents()}
</View>
</BottomSheet>
);
}

View File

@ -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);
});