Skip to content

Commit 5bdc8f2

Browse files
lucasffniftylettuce
authored andcommitted
Adds key to props so the library can be tested with snapshots. (#78)
1 parent 81ba930 commit 5bdc8f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ export default class Spinner extends React.PureComponent {
8282
visible: PropTypes.bool,
8383
indicatorStyle: PropTypes.object,
8484
customIndicator: PropTypes.element,
85-
children: PropTypes.element
85+
children: PropTypes.element,
86+
spinnerKey: PropTypes.string
8687
};
8788

8889
static defaultProps = {
@@ -140,7 +141,7 @@ export default class Spinner extends React.PureComponent {
140141
const spinner = (
141142
<View
142143
style={[styles.container, { backgroundColor: this.props.overlayColor }]}
143-
key={`spinner_${Date.now()}`}
144+
key={this.props.spinnerKey ? this.props.spinnerKey : `spinner_${Date.now()}`}
144145
>
145146
{this.props.children
146147
? this.props.children

0 commit comments

Comments
 (0)