Search code examples
reactjstypescripteditormaterial-uiavatar

Unable to rotate an image in react


I'm working on React-Avatar Editor. My rotate button is not functioning as expected. Here's my link to the code: https://codesandbox.io/s/example-for-react-avatar-editor-ofoz4


Solution

  • You weren't using the rotate value. I've fixed it in this fork:

    https://codesandbox.io/s/example-for-react-avatar-editor-dc6wh

                  <AvatarEditor
                    rotate={this.state.rotate}
                  />
    
    

    Also I've removed the rotate=0 in the rotation functions. Don't know if you want to rotate it completely or just once in every direction