-
Notifications
You must be signed in to change notification settings - Fork 6
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 #490 from hopetambala/PLATFORM_584_v2
Platform 584 v2
- Loading branch information
Showing
14 changed files
with
4,387 additions
and
29,482 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,49 @@ | ||
import PropTypes from 'prop-types'; | ||
import * as React from 'react'; | ||
import { Button } from 'react-native-paper'; | ||
import { Button as PaperButton } from 'react-native-paper'; | ||
|
||
import { layout, theme } from '../../modules/theme'; | ||
|
||
export default function PaperButton({ | ||
onPressEvent, buttonText, | ||
mode, compact, icon, disabled, loading, | ||
const colorStyle = { | ||
primary: theme.colors.primary, | ||
accent: theme.colors.accent, | ||
empty: theme.colors.placeholder, | ||
black: theme.colors.black | ||
}; | ||
|
||
const Button = ({ | ||
onPress, buttonText, | ||
mode, compact, icon, disabled, loading, color, | ||
style | ||
}) { | ||
return ( | ||
<Button | ||
icon={icon || ''} | ||
mode={mode || 'contained'} | ||
disabled={!!disabled} | ||
theme={theme} | ||
style={[layout.button, style]} | ||
onPress={onPressEvent} | ||
compact={!!compact} | ||
loading={!!loading} | ||
> | ||
{buttonText} | ||
</Button> | ||
); | ||
} | ||
}) => ( | ||
<PaperButton | ||
icon={icon || ''} | ||
mode={mode || 'contained'} | ||
disabled={!!disabled} | ||
theme={theme} | ||
style={[layout.button, style]} | ||
onPress={onPress} | ||
compact={!!compact} | ||
loading={!!loading} | ||
color={colorStyle[color]} | ||
> | ||
{buttonText} | ||
</PaperButton> | ||
); | ||
|
||
Button.defaultProps = { | ||
color: 'primary', | ||
icon: '', | ||
disabled: false, | ||
loading: false | ||
}; | ||
|
||
Button.propTypes = { | ||
color: PropTypes.oneOf(['primary', 'accent', 'empty', 'black']), | ||
icon: PropTypes.string, | ||
disabled: PropTypes.bool, | ||
loading: PropTypes.bool, | ||
onPress: PropTypes.func.isRequired | ||
}; | ||
|
||
export default Button; |
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
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.