Skip to content

Commit 257986e

Browse files
authored
Merge pull request #278 from henninghall/fix-fadeToColor--none
fix: fadeToColor "none" throws exception
2 parents 9f967bd + efe14d0 commit 257986e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

examples/detox/src/examples/Advanced.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ export default class Advanced extends Component {
173173
{
174174
name: 'fadeToColor',
175175
component: (
176-
<FadeToColor onChange={() => this.props.setBackground(randomColor())} />
176+
<FadeToColor
177+
onChange={() => this.props.setBackground(randomColor())}
178+
setNone={() => this.props.setBackground("none")}
179+
/>
177180
),
178181
},
179182
{

examples/detox/src/propPickers/FadeToColor.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { Button } from 'react-native'
33

44
export default class extends Component {
55
render() {
6-
return <Button title={'Change color'} onPress={this.props.onChange} />
6+
return <>
7+
<Button title={'Change color'} onPress={this.props.onChange} />
8+
<Button title={'Set "none"'} onPress={this.props.setNone} />
9+
</>
710
}
811
}

src/colorToHex.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export function colorToHex(c) {
22
if (c === undefined) return c
3+
if (c === "none") return c
34
if (c.includes('rgb')) return rgb2hex(c)
45
if (c.includes('#')) {
56
if (!isValidHex(c)) throw Error('Invalid color: ' + c)

0 commit comments

Comments
 (0)