Skip to content

Commit

Permalink
Merge pull request #173 from OpenBracketsCH/development
Browse files Browse the repository at this point in the history
Fix depencencies
  • Loading branch information
elektrolytmangel authored Nov 15, 2023
2 parents be1357b + 639008e commit 663808c
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 115 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/app-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Build iOS & Android
# Controls when the action will run.
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ development, main ]
branches: [development, main]
paths:
- 'app/**'
- "app/**"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
APP_SRC_PATH: './app/defikarte/' # set this to the path to your web app project, defaults to the repository root
APP_SRC_PATH: "./app/defikarte/" # set this to the path to your web app project, defaults to the repository root
RELEASE_PROFILE: "${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}"
REACT_NATIVE_BASE_URL: "${{ github.ref == 'refs/heads/main' && 'https://defikarte-backend.azurewebsites.net/api' || 'https://defikarte-backend-staging.azurewebsites.net/api' }}"
REACT_NATIVE_GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
REACT_NATIVE_GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API }}
REACT_NATIVE_API_KEY: ${{ secrets.AZURE_FUNCTIONAPP_API_KEY }}

jobs:
Expand All @@ -32,7 +32,7 @@ jobs:
expo-version: 6.x
eas-version: latest
token: ${{ secrets.EXPO_CLI_TOKEN }}
packager: 'npm'
packager: "npm"
- name: Install dependencies
working-directory: ${{ env.APP_SRC_PATH }}
run: npm ci
Expand Down
6 changes: 3 additions & 3 deletions app/defikarte/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Defikarte.ch",
"slug": "Defikarte-ch",
"owner": "defikarte",
"version": "1.0.24",
"version": "1.0.26",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
Expand All @@ -18,14 +18,14 @@
"ios": {
"supportsTablet": true,
"bundleIdentifier": "ch.defikarte.app",
"buildNumber": "1.0.24",
"buildNumber": "1.0.26",
"infoPlist": {
"NSLocationWhenInUseUsageDescription": "Diese App benötigt die Standortdaten deines Gerätes um den nächsten Defi anzeigen zu können."
}
},
"android": {
"package": "ch.defikarte.app",
"versionCode": 24,
"versionCode": 26,
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION"
Expand Down
40 changes: 23 additions & 17 deletions app/defikarte/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/defikarte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
"dotenv": "^16.3.1",
"eas": "^0.1.0",
"expo": "~49.0.13",
"expo-dev-client": "~2.4.11",
"expo-dev-client": "~2.4.12",
"expo-localization": "~14.3.0",
"expo-location": "~16.1.0",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"i18next": "^23.5.1",
"intl-pluralrules": "^2.0.1",
"libphonenumber-js": "^1.10.49",
"moment": "^2.29.4",
"opening_hours": "^3.8.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.47.0",
"react-native": "0.72.5",
"react-native": "0.72.6",
"react-native-gesture-handler": "~2.12.0",
"react-native-map-clustering": "^3.4.2",
"react-native-maps": "1.7.1",
Expand Down
75 changes: 47 additions & 28 deletions app/defikarte/src/components/TextForm.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
import React, { useState } from 'react';
import { View, Text, Switch, TextInput, StyleSheet } from 'react-native';
import React, { useState } from "react";
import { View, Text, Switch, TextInput, StyleSheet } from "react-native";
import { Controller } from "react-hook-form";

const TextForm = ({ labelText, keyboardType, defaultValue, multiline, placeholder, useSwitch = false, name, control, rules, errors, errorMsg, disabled }) => {
const TextForm = ({
labelText,
keyboardType,
defaultValue,
multiline,
placeholder,
useSwitch = false,
name,
control,
rules,
errors,
errorMsg,
disabled,
}) => {
const [switchValue, setSwitchValue] = useState(false);
const [tempValue, setTempValue] = useState('');
const [tempValue, setTempValue] = useState("");

const onSwitchChange = (newVal, value, setValue) => {
setSwitchValue(newVal);
setTempValue(value);
// if newVal from switch (bool) is true, use default value
const val = newVal ? defaultValue : tempValue;
setValue(val);
}
};

const defaultWithSwitch = (value, onChange) => {
const textStyle = switchValue ? styles.switchActiveLabelStyle : styles.switchLabelStyle;
const textStyle = switchValue
? styles.switchActiveLabelStyle
: styles.switchLabelStyle;
if (useSwitch) {
return (
<View style={styles.switchContainerStyle}>
<Switch
style={styles.switchStyle}
onValueChange={newVal => onSwitchChange(newVal, value, onChange)}
onValueChange={(newVal) => onSwitchChange(newVal, value, onChange)}
value={switchValue}
disabled={disabled}
/>
Expand All @@ -31,7 +46,7 @@ const TextForm = ({ labelText, keyboardType, defaultValue, multiline, placeholde
}

return null;
}
};

const showTextInput = (onChange, onBlur, value) => {
if (!switchValue) {
Expand All @@ -41,40 +56,44 @@ const TextForm = ({ labelText, keyboardType, defaultValue, multiline, placeholde
value={value}
onChangeText={onChange}
onBlur={onBlur}
autoCapitalize='none'
autoCapitalize="none"
keyboardType={keyboardType}
defaultValue={useSwitch ? '' : defaultValue}
defaultValue={useSwitch ? "" : defaultValue}
multiline={multiline}
autoGrow={true}
placeholder={placeholder}
autoCorrect={false}
editable={!switchValue}
returnKeyType={multiline ? 'default' : 'done'}
returnKeyType={multiline ? "default" : "done"}
/>
);
}
};

return (
<View style={styles.inlineForm} >
<View style={styles.inlineForm}>
<Controller
control={control}
name={name}
rules={rules}
defaultValue={useSwitch ? '' : defaultValue}
defaultValue={useSwitch ? "" : defaultValue}
render={({ field }) => {
return (
<>
<View style={styles.inlineSwitchStyle} >
<View style={styles.inlineSwitchStyle}>
<Text style={styles.labelStyle}>{labelText}</Text>
{defaultWithSwitch(field.value, field.onChange)}
</View>
{showTextInput(field.onChange, field.onBlur, field.value)}
</>
)
);
}}
/>
{(errors && errors[name]) && <Text style={styles.errorTextStyle}>{errorMsg}</Text>}
{errors && errors[name] && (
<Text style={styles.errorTextStyle}>
{errorMsg ?? errors[name]?.message}
</Text>
)}
</View>
);
};
Expand All @@ -86,23 +105,23 @@ const styles = StyleSheet.create({
marginVertical: 10,
},
inlineSwitchStyle: {
flexDirection: 'row',
alignItems: 'center',
flexDirection: "row",
alignItems: "center",
},
labelStyle: {
fontSize: 18,
marginRight: 10,
color: 'rgba(70, 70, 70, 1)',
color: "rgba(70, 70, 70, 1)",
},
inputStyle: {
borderColor: 'rgba(200, 200, 200, 1)',
borderColor: "rgba(200, 200, 200, 1)",
borderBottomWidth: 1,
fontSize: 18,
padding: 5,
},
switchContainerStyle: {
flexDirection: 'row',
alignItems: 'center',
flexDirection: "row",
alignItems: "center",
},
switchStyle: {
marginRight: 10,
Expand All @@ -111,19 +130,19 @@ const styles = StyleSheet.create({
switchLabelStyle: {
fontSize: 16,
marginRight: 10,
color: 'rgba(140, 140, 140, 1)',
color: "rgba(140, 140, 140, 1)",
},
switchActiveLabelStyle: {
fontSize: 16,
marginRight: 10,
color: '#007AFF',
fontWeight: 'bold'
color: "#007AFF",
fontWeight: "bold",
},
errorTextStyle: {
fontSize: 16,
color: 'red',
color: "red",
marginTop: 3,
}
},
});

export default TextForm;
export default TextForm;
Loading

0 comments on commit 663808c

Please sign in to comment.