Skip to content

Commit

Permalink
bugfix: fadeToColor none
Browse files Browse the repository at this point in the history
  • Loading branch information
henninghall committed Dec 28, 2020
1 parent aa30f8e commit c09da74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/detox/src/examples/Advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ export default class Advanced extends Component {
{
name: 'fadeToColor',
component: (
<FadeToColor onChange={() => this.props.setBackground(randomColor())} />
<FadeToColor
onChange={() => this.props.setBackground(randomColor())}
setNone={() => this.props.setBackground("none")}
/>
),
},
{
Expand Down
5 changes: 4 additions & 1 deletion examples/detox/src/propPickers/FadeToColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Button } from 'react-native'

export default class extends Component {
render() {
return <Button title={'Change color'} onPress={this.props.onChange} />
return <>
<Button title={'Change color'} onPress={this.props.onChange} />
<Button title={'Set "none"'} onPress={this.props.setNone} />
</>
}
}
1 change: 1 addition & 0 deletions src/colorToHex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export function colorToHex(c) {
if (c === undefined) return c
if (c === "none") return c
if (c.includes('rgb')) return rgb2hex(c)
if (c.includes('#')) {
if (!isValidHex(c)) throw Error('Invalid color: ' + c)
Expand Down

0 comments on commit c09da74

Please sign in to comment.