Skip to content

Commit b9b522b

Browse files
skuzolukethanshar
authored andcommitted
Fixed this.setState error for android api under 17 (#241)
* Fixed this.setState error for android api under 17 This function is throwing error on android api <= 17 because of getComponentDimensions scope. What i did is bind this context to the function on construnctor. Now there is no more error thrown. * Fix for android platform <=17 Same this.setState error in another button component
1 parent 5de2c88 commit b9b522b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/components/button/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default class Button extends BaseComponent {
138138
if (!_.isUndefined(props.containerStyle)) {
139139
console.error('Button "containerStyle" prop will be deprecated soon, please use "style" instead');
140140
}
141+
this.getComponentDimensions = this.getComponentDimensions.bind(this);
141142
}
142143

143144
// This method will be called more than once in case of layout change!

typings/components/button/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class Button extends BaseComponent {
2121
if (!_.isUndefined(props.containerStyle)) {
2222
console.error('Button "containerStyle" prop will be deprecated soon, please use "style" instead');
2323
}
24+
this.getComponentDimensions = this.getComponentDimensions.bind(this);
2425
}
2526
// This method will be called more than once in case of layout change!
2627
getComponentDimensions(event) {

0 commit comments

Comments
 (0)