Skip to content

TypeError: this.setState is not a function #82

@anisharya16

Description

@anisharya16

Is this a bug report, a feature request, or a question?
Bug

Is the bug reproducible in a production environment (not a debug one)?
Yes

Environment
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-responsive-screen": "^1.4.1",

Target Platform:
Android (9.0)

Bug:
TypeError: this.setState is not a function. (In 'this.setState({orientation: screenWidth < screenHeight ? 'portrait' : 'landscape'})', 'this.setState' is undefined)

I was using class component but had to change it to functional component as per project requirement. Since I changed it to functional component, orientation change is not working and am getting this error. I have attached screenshot for reference to this. Need solution for this, as i have used this library many times in my project.

WhatsApp Image 2020-07-20 at 12 00 28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions