Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
Feature/default images (#1)
Browse files Browse the repository at this point in the history
* Added default images

* bump to 1.2.0
  • Loading branch information
rafaelmotta authored Mar 23, 2018
1 parent d42bf6c commit a47c5ac
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-scl-alert",
"version": "1.1.1",
"version": "1.2.0",
"description": "A React Native implementation of the package SCLAlertView",
"author": "Rafael Michels Motta <[email protected]>",
"license": "MIT",
Expand Down
15 changes: 11 additions & 4 deletions src/components/SCLAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class SCLAlert extends React.Component {
}

/**
* @description
* @description get animation interpolation
* @return { Array }
*/
get interpolationTranslate () {
const move = this.slideAnimation.interpolate({
Expand All @@ -65,15 +66,17 @@ class SCLAlert extends React.Component {
}

/**
* @description
* @description show modal
* @return { Void }
*/
show = () => {
this._runAnimationAsync()
this.setState({ show: true })
}

/**
* @description
* @description hide modal
* @return { Void }
*/
hide = async () => {
await this._runAnimationAsync()
Expand All @@ -83,7 +86,7 @@ class SCLAlert extends React.Component {
/**
* @description run slide animation to show action sheet contetn
* @param { Boolean } show - Show / Hide content
* @return { Void }
* @return { Promise }
*/
_runAnimationAsync = () => {
return new Promise(resolve => {
Expand All @@ -100,6 +103,10 @@ class SCLAlert extends React.Component {
})
}

/**
* @description callback after press in the overlay
* @return { Void }
*/
handleOnClose = () => {
this.props.cancellable && this.props.onRequestClose()
}
Expand Down
16 changes: 11 additions & 5 deletions src/components/SCLAlertHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import PropTypes from 'prop-types'
import {
View,
ViewPropTypes,
StyleSheet
StyleSheet,
Image
} from 'react-native'

import images from '../config/images'
import variables from '../config/variables'

import {
Expand All @@ -30,17 +32,17 @@ SCLAlertHeader.defaultProps = {

function SCLAlertHeader (props) {
return (
<View style={[
styles.container,
styles.headerContainerStyles
]}>
<View style={[styles.container, styles.headerContainerStyles]}>
<View
style={[
styles.inner,
styles.headerInnerStyles,
{ backgroundColor: variables[`${props.theme}Background`] }
]}
>
{!props.headerIconComponent && (
<Image source={{ uri: images[props.theme] }} style={styles.image} />
)}
{props.headerIconComponent}
</View>
</View>
Expand All @@ -62,6 +64,10 @@ const styles = StyleSheet.create({
borderColor: variables.white,
justifyContent: 'center',
alignItems: 'center'
},
image: {
height: 32,
width: 32
}
})

Expand Down
15 changes: 2 additions & 13 deletions src/components/SCLAlertSubtitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ SCLAlertSubtitle.defaultProps = {

function SCLAlertSubtitle (props) {
return (
<View
style={[
styles.container,
props.subtitleContainerStyle
]}
>
<Text
numberOfLines={2}
style={[
styles.subtitle,
props.subtitleStyle
]}
>
<View style={[styles.container, props.subtitleContainerStyle]}>
<Text numberOfLines={2} style={[styles.subtitle, props.subtitleStyle]}>
{props.subtitle}
</Text>
</View>
Expand Down
15 changes: 2 additions & 13 deletions src/components/SCLAlertTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ SCLAlertTitle.defaultProps = {

function SCLAlertTitle (props) {
return (
<View
style={[
styles.container,
props.titleContainerStyle
]}
>
<Text
numberOfLines={1}
style={[
styles.text,
props.titleStyle
]}
>
<View style={[styles.container, props.titleContainerStyle]}>
<Text numberOfLines={1} style={[styles.text, props.titleStyle]}>
{props.title}
</Text>
</View>
Expand Down
10 changes: 10 additions & 0 deletions src/config/images.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/config/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
},

get default () {
return '#f1f1fa'
return '#e0e0e0'
},

get inverse () {
Expand All @@ -73,8 +73,8 @@ export default {
return '#dc3545'
},

get warningTheme () {
return '#ff3b30'
get warning () {
return '#ffc107'
},

/**
Expand Down

0 comments on commit a47c5ac

Please sign in to comment.