Skip to content

Commit 505dc08

Browse files
authored
Merge pull request #55 from MateuszWolkowicz/patch-1
Preventing automatic call button onPress
2 parents 68e31f0 + dfff86b commit 505dc08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

App/Containers/Example/ExampleScreen.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const instructions = Platform.select({
2121

2222
class ExampleScreen extends React.Component {
2323
componentDidMount() {
24-
this.props.fetchUser()
24+
this._fetchUser()
2525
}
2626

2727
render() {
@@ -49,12 +49,16 @@ class ExampleScreen extends React.Component {
4949
</Text>
5050
</View>
5151
)}
52-
<Button onPress={this.props.fetchUser} title="Refresh" />
52+
<Button onPress={() => this._fetchUser()} title="Refresh" />
5353
</View>
5454
)}
5555
</View>
5656
)
5757
}
58+
59+
_fetchUser() {
60+
this.props.fetchUser()
61+
}
5862
}
5963

6064
ExampleScreen.propTypes = {

0 commit comments

Comments
 (0)