-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
303 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module.exports = function(api) { | ||
module.exports = function (api) { | ||
api.cache(true); | ||
return { | ||
presets: ['babel-preset-expo'], | ||
plugins: ['react-native-reanimated/plugin'], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
import { StyleSheet, View } from 'react-native'; | ||
import React, { FC, memo } from 'react'; | ||
import React, { FC, memo, useMemo } from 'react'; | ||
import { useTheme } from '../hooks/ThemeContext'; | ||
import { IStyle } from '../models/props/IStyle'; | ||
import { ITheme } from '../models/ITheme'; | ||
|
||
interface Props { | ||
isBetween: boolean; | ||
firstSelection: boolean; | ||
secondSelection: boolean; | ||
} | ||
|
||
const BetweenDates: FC<Props> = ({ isBetween, firstSelection, secondSelection }) => { | ||
const context = useTheme(); | ||
// #region HOOKS | ||
const theme = useTheme(); | ||
// #endregion | ||
// #region FUNCTIONS | ||
const themedStyles = useMemo(() => styles(theme), [theme]); | ||
// #endregion | ||
|
||
const style = () => { | ||
return styles(context.colors); | ||
}; | ||
return ( | ||
<View style={[style().root, isBetween && style().isBetween, firstSelection && style().isLeftEdge, secondSelection && style().isRightEdge]} /> | ||
<View | ||
style={[ | ||
themedStyles.root, | ||
isBetween && themedStyles.isBetween, | ||
firstSelection && themedStyles.isLeftEdge, | ||
secondSelection && themedStyles.isRightEdge, | ||
]} | ||
/> | ||
); | ||
}; | ||
|
||
export default memo(BetweenDates); | ||
|
||
const styles = (theme: IStyle) => | ||
const styles = (theme: ITheme) => | ||
StyleSheet.create({ | ||
root: { | ||
...StyleSheet.absoluteFillObject, | ||
marginVertical: 0.5, | ||
zIndex: 0, | ||
marginVertical: 1, | ||
}, | ||
isBetween: { backgroundColor: theme.primaryVariant }, | ||
isBetween: { backgroundColor: theme.colors.primaryVariant }, | ||
isLeftEdge: { marginStart: 30 }, | ||
isRightEdge: { marginEnd: 30 }, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | ||
import React, { FC, memo, useMemo } from 'react'; | ||
import { format, isToday } from 'date-fns'; | ||
import { useTheme } from '../hooks/ThemeContext'; | ||
import { ITheme } from '../models/ITheme'; | ||
|
||
interface Props { | ||
item: Date; | ||
selected: boolean; | ||
isCurrentMonth: boolean; | ||
onChange: (value: Date) => void; | ||
} | ||
const DayCell: FC<Props> = ({ item, selected, isCurrentMonth, onChange }) => { | ||
// #region HOOKS | ||
const theme = useTheme(); | ||
// #endregion | ||
// #region FUNCTIONS | ||
const themedStyles = useMemo(() => styles(theme), [theme]); | ||
// #endregion | ||
return ( | ||
<TouchableOpacity activeOpacity={1} style={[themedStyles.root]} onPress={() => onChange(item)}> | ||
<View style={[selected && themedStyles.selectedBackground, themedStyles.container]}> | ||
<Text | ||
numberOfLines={1} | ||
adjustsFontSizeToFit | ||
style={[themedStyles.text, selected && themedStyles.selectedText, !isCurrentMonth && !selected && themedStyles.differentMonthText]} | ||
> | ||
{format(item, 'dd')} | ||
</Text> | ||
|
||
{isToday(item) && ( | ||
<View | ||
style={{ | ||
height: 3, | ||
width: 3, | ||
borderRadius: 3, | ||
backgroundColor: selected ? theme.colors.onPrimary : theme.colors.primary, | ||
position: 'absolute', | ||
alignSelf: 'center', | ||
bottom: 6, | ||
}} | ||
/> | ||
)} | ||
</View> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
export default memo(DayCell); | ||
|
||
const styles = (theme: ITheme) => | ||
StyleSheet.create({ | ||
root: { flex: 1, alignItems: 'center' }, | ||
container: { flex: 1, alignItems: 'center', justifyContent: 'center' }, | ||
selectedBackground: { | ||
borderRadius: 100, | ||
aspectRatio: 1, | ||
backgroundColor: theme.colors.primary, | ||
shadowColor: '#000', | ||
shadowOffset: { | ||
width: 0, | ||
height: 1, | ||
}, | ||
shadowOpacity: 0.22, | ||
shadowRadius: 2.22, | ||
elevation: 3, | ||
borderWidth: 3, | ||
borderColor: theme.colors.onPrimary, | ||
}, | ||
selectedText: { color: theme.colors.onPrimary }, | ||
differentMonthText: { color: theme.colors.onPrimaryVariant }, | ||
text: { fontSize: 14 }, | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.