-
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.
Merge pull request #82 from degica/task/MOB-63-loading-integration
loading animation integration
- Loading branch information
Showing
23 changed files
with
401 additions
and
157 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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, Keyboard } from "react-native"; | ||
|
||
import { useTranslation } from "react-i18next"; | ||
|
||
import { ThemeSchemeType } from "../util/types"; | ||
|
||
import { resizeFonts, responsiveScale } from "../theme/scalling"; | ||
import { useCurrentTheme } from "../theme/useCurrentTheme"; | ||
import { ReactNode } from "react"; | ||
|
||
type Props = { | ||
onPress: () => void; | ||
label: string; | ||
labelSuffix?: string; | ||
testID?: string; | ||
style?: object; | ||
disabled?: boolean; | ||
children?: ReactNode; | ||
}; | ||
|
||
const Button = ({ | ||
label, | ||
labelSuffix, | ||
onPress, | ||
testID, | ||
style, | ||
disabled = false, | ||
children, | ||
}: Props) => { | ||
const { t } = useTranslation(); | ||
const theme = useCurrentTheme(); | ||
const styles = getStyles(theme); | ||
|
||
const onSubmit = () => { | ||
Keyboard.dismiss(); | ||
onPress(); | ||
}; | ||
|
||
return ( | ||
<TouchableOpacity | ||
testID={testID} | ||
style={[styles.buttonWrapper, style]} | ||
onPress={onSubmit} | ||
disabled={disabled} | ||
> | ||
<Text style={styles.label}> | ||
{labelSuffix ? `${t(label)} ${labelSuffix}` : t(label)} | ||
</Text> | ||
{children} | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
export default Button; | ||
|
||
const getStyles = (theme: ThemeSchemeType) => { | ||
return StyleSheet.create({ | ||
buttonWrapper: { | ||
backgroundColor: theme.PRIMARY_COLOR, | ||
borderRadius: responsiveScale(8), | ||
height: responsiveScale(50), | ||
marginHorizontal: responsiveScale(16), | ||
flex: 1, | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}, | ||
label: { | ||
color: "white", | ||
fontSize: resizeFonts(16), | ||
fontWeight: "bold", | ||
}, | ||
}); | ||
}; |
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
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
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
Oops, something went wrong.