Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikalberts committed Mar 27, 2022
0 parents commit 1186f29
Show file tree
Hide file tree
Showing 42,774 changed files with 4,984,749 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GOOGLE_API_KEY = "AIzaSyD7rCokKUIem_Su3Fm4Tmoq6meNGvbima0"
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src\models
4 changes: 4 additions & 0 deletions .expo-shared/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}
15 changes: 15 additions & 0 deletions .expo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
> Why do I have a folder named ".expo" in my project?
The ".expo" folder is created when an Expo project is started using "expo start" command.

> What do the files contain?
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
- "settings.json": contains the server configuration that is used to serve the application manifest.

> Should I commit the ".expo" folder?
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.

Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
10 changes: 10 additions & 0 deletions .expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devToolsPort": 19002,
"expoServerPort": null,
"packagerPort": null,
"webpackServerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null
}
10 changes: 10 additions & 0 deletions .expo/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null,
"https": false,
"scheme": null,
"devClient": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { hydrate, render } from 'react-dom';\nexport { hydrate };\nexport default render;","map":{"version":3,"sources":["C:/Users/hendrik/Documents/mobiledev/mapareacalc/node_modules/react-native-web/dist/exports/render/index.js"],"names":["hydrate","render"],"mappings":"AAQA,SAASA,OAAT,EAAkBC,MAAlB,QAAgC,WAAhC;AACA,SAASD,OAAT;AACA,eAAeC,MAAf","sourcesContent":["/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nimport { hydrate, render } from 'react-dom';\nexport { hydrate };\nexport default render;"]},"metadata":{},"sourceType":"module"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"status\", \"theme\", \"disabled\", \"onPress\", \"testID\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nimport * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport View from \"react-native-web/dist/exports/View\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport color from 'color';\nimport MaterialCommunityIcon from \"../MaterialCommunityIcon\";\nimport TouchableRipple from \"../TouchableRipple/TouchableRipple\";\nimport { withTheme } from \"../../core/theming\";\nvar ANIMATION_DURATION = 100;\n\nvar CheckboxAndroid = function CheckboxAndroid(_ref) {\n var status = _ref.status,\n theme = _ref.theme,\n disabled = _ref.disabled,\n onPress = _ref.onPress,\n testID = _ref.testID,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n var _React$useRef = React.useRef(new Animated.Value(1)),\n scaleAnim = _React$useRef.current;\n\n var isFirstRendering = React.useRef(true);\n var scale = theme.animation.scale;\n React.useEffect(function () {\n if (isFirstRendering.current) {\n isFirstRendering.current = false;\n return;\n }\n\n var checked = status === 'checked';\n Animated.sequence([Animated.timing(scaleAnim, {\n toValue: 0.85,\n duration: checked ? ANIMATION_DURATION * scale : 0,\n useNativeDriver: false\n }), Animated.timing(scaleAnim, {\n toValue: 1,\n duration: checked ? ANIMATION_DURATION * scale : ANIMATION_DURATION * scale * 1.75,\n useNativeDriver: false\n })]).start();\n }, [status, scaleAnim, scale]);\n var checked = status === 'checked';\n var indeterminate = status === 'indeterminate';\n var checkedColor = rest.color || theme.colors.accent;\n var uncheckedColor = rest.uncheckedColor || color(theme.colors.text).alpha(theme.dark ? 0.7 : 0.54).rgb().string();\n var rippleColor, checkboxColor;\n\n if (disabled) {\n rippleColor = color(theme.colors.text).alpha(0.16).rgb().string();\n checkboxColor = theme.colors.disabled;\n } else {\n rippleColor = color(checkedColor).fade(0.32).rgb().string();\n checkboxColor = checked ? checkedColor : uncheckedColor;\n }\n\n var borderWidth = scaleAnim.interpolate({\n inputRange: [0.8, 1],\n outputRange: [7, 0]\n });\n var icon = indeterminate ? 'minus-box' : checked ? 'checkbox-marked' : 'checkbox-blank-outline';\n return React.createElement(TouchableRipple, _extends({}, rest, {\n borderless: true,\n rippleColor: rippleColor,\n onPress: onPress,\n disabled: disabled,\n accessibilityTraits: disabled ? ['button', 'disabled'] : 'button',\n accessibilityComponentType: \"button\",\n accessibilityRole: \"checkbox\",\n accessibilityState: {\n disabled: disabled,\n checked: checked\n },\n accessibilityLiveRegion: \"polite\",\n style: styles.container,\n testID: testID\n }), React.createElement(Animated.View, {\n style: {\n transform: [{\n scale: scaleAnim\n }]\n }\n }, React.createElement(MaterialCommunityIcon, {\n allowFontScaling: false,\n name: icon,\n size: 24,\n color: checkboxColor,\n direction: \"ltr\"\n }), React.createElement(View, {\n style: [StyleSheet.absoluteFill, styles.fillContainer]\n }, React.createElement(Animated.View, {\n style: [styles.fill, {\n borderColor: checkboxColor\n }, {\n borderWidth: borderWidth\n }]\n }))));\n};\n\nCheckboxAndroid.displayName = 'Checkbox.Android';\nvar styles = StyleSheet.create({\n container: {\n borderRadius: 18,\n width: 36,\n height: 36,\n padding: 6\n },\n fillContainer: {\n alignItems: 'center',\n justifyContent: 'center'\n },\n fill: {\n height: 14,\n width: 14\n }\n});\nexport default withTheme(CheckboxAndroid);\nvar CheckboxAndroidWithTheme = withTheme(CheckboxAndroid);\nexport { CheckboxAndroidWithTheme as CheckboxAndroid };","map":{"version":3,"sources":["CheckboxAndroid.tsx"],"names":["ANIMATION_DURATION","CheckboxAndroid","rest","current","scaleAnim","React","Animated","isFirstRendering","animation","scale","checked","status","toValue","duration","useNativeDriver","indeterminate","checkedColor","theme","uncheckedColor","color","rippleColor","checkboxColor","borderWidth","inputRange","outputRange","icon","disabled","styles","testID","transform","StyleSheet","borderColor","container","borderRadius","width","height","padding","fillContainer","alignItems","justifyContent","fill","withTheme","CheckboxAndroidWithTheme"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAP,KAAA,MAAA,OAAA;;;;AAEA,OAAA,KAAA,MAAA,OAAA;AACA,OAAA,qBAAA;AACA,OAAA,eAAA;AACA,SAAA,SAAA;AAmCA,IAAMA,kBAAkB,GAAxB,GAAA;;AAkBA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,OAOX;AAAA,MAPY,MAOZ,QAPY,MAOZ;AAAA,MAPY,KAOZ,QAPY,KAOZ;AAAA,MAPY,QAOZ,QAPY,QAOZ;AAAA,MAPY,OAOZ,QAPY,OAOZ;AAAA,MAPY,MAOZ,QAPY,MAOZ;AAAA,MADRC,IACQ;;AACX,sBAA+BG,KAAK,CAALA,MAAAA,CAC7B,IAAIC,QAAQ,CAAZ,KAAA,CADF,CACE,CAD6BD,CAA/B;AAAA,MAAiBD,SAAjB,iBAAQD,OAAR;;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E;AACJL,IAAAA,MAAM,EADF,EAAA;AAEJD,IAAAA,KAAK,EAAE;AAFH;AAXyB,CAAlB,CAAf;AAiBA,eAAeO,SAAS,CAAxB,eAAwB,CAAxB;AAGA,IAAMC,wBAAwB,GAAGD,SAAS,CAA1C,eAA0C,CAA1C;AAEA,SAASC,wBAAwB,IAAjC,eAAA","sourcesContent":["import * as React from 'react';\nimport { Animated, View, StyleSheet } from 'react-native';\nimport color from 'color';\nimport MaterialCommunityIcon from '../MaterialCommunityIcon';\nimport TouchableRipple from '../TouchableRipple/TouchableRipple';\nimport { withTheme } from '../../core/theming';\nimport type { $RemoveChildren } from '../../types';\n\ntype Props = $RemoveChildren<typeof TouchableRipple> & {\n /**\n * Status of checkbox.\n */\n status: 'checked' | 'unchecked' | 'indeterminate';\n /**\n * Whether checkbox is disabled.\n */\n disabled?: boolean;\n /**\n * Function to execute on press.\n */\n onPress?: () => void;\n /**\n * Custom color for unchecked checkbox.\n */\n uncheckedColor?: string;\n /**\n * Custom color for checkbox.\n */\n color?: string;\n /**\n * @optional\n */\n theme: ReactNativePaper.Theme;\n /**\n * testID to be used on tests.\n */\n testID?: string;\n};\n\n// From https://material.io/design/motion/speed.html#duration\nconst ANIMATION_DURATION = 100;\n\n/**\n * Checkboxes allow the selection of multiple options from a set.\n * This component follows platform guidelines for Android, but can be used\n * on any platform.\n *\n * <div class=\"screenshots\">\n * <figure>\n * <img src=\"screenshots/checkbox-enabled.android.png\" />\n * <figcaption>Enabled</figcaption>\n * </figure>\n * <figure>\n * <img src=\"screenshots/checkbox-disabled.android.png\" />\n * <figcaption>Disabled</figcaption>\n * </figure>\n * </div>\n */\nconst CheckboxAndroid = ({\n status,\n theme,\n disabled,\n onPress,\n testID,\n ...rest\n}: Props) => {\n const { current: scaleAnim } = React.useRef<Animated.Value>(\n new Animated.Value(1)\n );\n const isFirstRendering = React.useRef<boolean>(true);\n\n const {\n animation: { scale },\n } = theme;\n\n React.useEffect(() => {\n // Do not run animation on very first rendering\n if (isFirstRendering.current) {\n isFirstRendering.current = false;\n return;\n }\n\n const checked = status === 'checked';\n\n Animated.sequence([\n Animated.timing(scaleAnim, {\n toValue: 0.85,\n duration: checked ? ANIMATION_DURATION * scale : 0,\n useNativeDriver: false,\n }),\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: checked\n ? ANIMATION_DURATION * scale\n : ANIMATION_DURATION * scale * 1.75,\n useNativeDriver: false,\n }),\n ]).start();\n }, [status, scaleAnim, scale]);\n\n const checked = status === 'checked';\n const indeterminate = status === 'indeterminate';\n const checkedColor = rest.color || theme.colors.accent;\n const uncheckedColor =\n rest.uncheckedColor ||\n color(theme.colors.text)\n .alpha(theme.dark ? 0.7 : 0.54)\n .rgb()\n .string();\n\n let rippleColor, checkboxColor;\n\n if (disabled) {\n rippleColor = color(theme.colors.text).alpha(0.16).rgb().string();\n checkboxColor = theme.colors.disabled;\n } else {\n rippleColor = color(checkedColor).fade(0.32).rgb().string();\n checkboxColor = checked ? checkedColor : uncheckedColor;\n }\n\n const borderWidth = scaleAnim.interpolate({\n inputRange: [0.8, 1],\n outputRange: [7, 0],\n });\n\n const icon = indeterminate\n ? 'minus-box'\n : checked\n ? 'checkbox-marked'\n : 'checkbox-blank-outline';\n\n return (\n <TouchableRipple\n {...rest}\n borderless\n rippleColor={rippleColor}\n onPress={onPress}\n disabled={disabled}\n // @ts-expect-error We keep old a11y props for backwards compat with old RN versions\n accessibilityTraits={disabled ? ['button', 'disabled'] : 'button'}\n accessibilityComponentType=\"button\"\n accessibilityRole=\"checkbox\"\n accessibilityState={{ disabled, checked }}\n accessibilityLiveRegion=\"polite\"\n style={styles.container}\n testID={testID}\n >\n <Animated.View style={{ transform: [{ scale: scaleAnim }] }}>\n <MaterialCommunityIcon\n allowFontScaling={false}\n name={icon}\n size={24}\n color={checkboxColor}\n direction=\"ltr\"\n />\n <View style={[StyleSheet.absoluteFill, styles.fillContainer]}>\n <Animated.View\n style={[\n styles.fill,\n { borderColor: checkboxColor },\n { borderWidth },\n ]}\n />\n </View>\n </Animated.View>\n </TouchableRipple>\n );\n};\n\nCheckboxAndroid.displayName = 'Checkbox.Android';\n\nconst styles = StyleSheet.create({\n container: {\n borderRadius: 18,\n width: 36,\n height: 36,\n padding: 6,\n },\n fillContainer: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n fill: {\n height: 14,\n width: 14,\n },\n});\n\nexport default withTheme(CheckboxAndroid);\n\n// @component-docs ignore-next-line\nconst CheckboxAndroidWithTheme = withTheme(CheckboxAndroid);\n// @component-docs ignore-next-line\nexport { CheckboxAndroidWithTheme as CheckboxAndroid };\n"]},"metadata":{},"sourceType":"module"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"state\"];\nimport * as React from 'react';\nexport var CHILD_STATE = Symbol('CHILD_STATE');\nexport default function useRouteCache(routes) {\n var cache = React.useMemo(function () {\n return {\n current: new Map()\n };\n }, []);\n\n if (process.env.NODE_ENV === 'production') {\n return routes;\n }\n\n cache.current = routes.reduce(function (acc, route) {\n var previous = cache.current.get(route);\n\n if (previous) {\n acc.set(route, previous);\n } else {\n var state = route.state,\n proxy = _objectWithoutProperties(route, _excluded);\n\n Object.defineProperty(proxy, CHILD_STATE, {\n enumerable: false,\n value: state\n });\n acc.set(route, proxy);\n }\n\n return acc;\n }, new Map());\n return Array.from(cache.current.values());\n}","map":{"version":3,"sources":["useRouteCache.tsx"],"names":["CHILD_STATE","Symbol","cache","current","process","previous","acc","proxy","Object","enumerable","value","state","Array"],"mappings":";;AAKA,OAAO,KAAP,KAAA,MAAA,OAAA;AAWA,OAAO,IAAMA,WAAW,GAAGC,MAAM,CAA1B,aAA0B,CAA1B;AAMP,eAAe,SAAA,aAAA,CAAA,MAAA,EAEb;AAEA,MAAMC,KAAK,GAAG,KAAK,CAAL,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,OAAO,EAAE,IAAA,GAAA;AAAX,KAAP;AAAA,GAAd,EAAd,EAAc,CAAd;;AAEA,MAAIC,OAAO,CAAPA,GAAAA,CAAAA,QAAAA,KAAJ,YAAA,EAA2C;AAEzC,WAAA,MAAA;AACD;;AAEDF,EAAAA,KAAK,CAALA,OAAAA,GAAgB,MAAM,CAAN,MAAA,CAAc,UAAA,GAAA,EAAA,KAAA,EAAgB;AAC5C,QAAMG,QAAQ,GAAGH,KAAK,CAALA,OAAAA,CAAAA,GAAAA,CAAjB,KAAiBA,CAAjB;;AAEA,QAAA,QAAA,EAAc;AAEZI,MAAAA,GAAG,CAAHA,GAAAA,CAAAA,KAAAA,EAAAA,QAAAA;AAFF,KAAA,MAGO;AACL,UAAM,KAAN,GAAA,KAAA,CAAM,KAAN;AAAA,UAAkBC,KAAlB,4BAAA,KAAA;;AAEAC,MAAAA,MAAM,CAANA,cAAAA,CAAAA,KAAAA,EAAAA,WAAAA,EAA0C;AACxCC,QAAAA,UAAU,EAD8B,KAAA;AAExCC,QAAAA,KAAK,EAAEC;AAFiC,OAA1CH;AAKAF,MAAAA,GAAG,CAAHA,GAAAA,CAAAA,KAAAA,EAAAA,KAAAA;AACD;;AAED,WAAA,GAAA;AAjBc,GAAA,EAkBb,IAlBHJ,GAkBG,EAlBa,CAAhBA;AAoBA,SAAOU,KAAK,CAALA,IAAAA,CAAWV,KAAK,CAALA,OAAAA,CAAlB,MAAkBA,EAAXU,CAAP;AACD","sourcesContent":["import type {\n NavigationState,\n ParamListBase,\n Route,\n} from '@react-navigation/routers';\nimport * as React from 'react';\n\nimport type { RouteProp } from './types';\n\ntype RouteCache = Map<Route<string>, RouteProp<ParamListBase>>;\n\n/**\n * Utilites such as `getFocusedRouteNameFromRoute` need to access state.\n * So we need a way to suppress the warning for those use cases.\n * This is fine since they are internal utilities and this is not public API.\n */\nexport const CHILD_STATE = Symbol('CHILD_STATE');\n\n/**\n * Hook to cache route props for each screen in the navigator.\n * This lets add warnings and modifications to the route object but keep references between renders.\n */\nexport default function useRouteCache<State extends NavigationState>(\n routes: State['routes']\n) {\n // Cache object which holds route objects for each screen\n const cache = React.useMemo(() => ({ current: new Map() as RouteCache }), []);\n\n if (process.env.NODE_ENV === 'production') {\n // We don't want the overhead of creating extra maps every render in prod\n return routes;\n }\n\n cache.current = routes.reduce((acc, route) => {\n const previous = cache.current.get(route);\n\n if (previous) {\n // If a cached route object already exists, reuse it\n acc.set(route, previous);\n } else {\n const { state, ...proxy } = route;\n\n Object.defineProperty(proxy, CHILD_STATE, {\n enumerable: false,\n value: state,\n });\n\n acc.set(route, proxy);\n }\n\n return acc;\n }, new Map() as RouteCache);\n\n return Array.from(cache.current.values());\n}\n"]},"metadata":{},"sourceType":"module"}
Loading

0 comments on commit 1186f29

Please sign in to comment.