Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: this.input.focus is not a function #102

Open
alefnula opened this issue Nov 22, 2017 · 1 comment
Open

TypeError: this.input.focus is not a function #102

alefnula opened this issue Nov 22, 2017 · 1 comment
Labels

Comments

@alefnula
Copy link

This is the simplest app that produces this error (generated using create-react-app):

import React, { Component } from 'react';
import {TextInput} from 'react-desktop/macOs'

class App extends Component {
  focus() {
    this.input.focus();
  }

  render() {
    return (
      <div>
        <TextInput ref={(input) => { this.input = input; }}/>
        <button onClick={(e) => this.focus()}>Focus</button>
      </div>
    );
  }
}

When I click the button I get:

App.js:8 Uncaught TypeError: this.input.focus is not a function
    at App.focus (App.js:8)
    at onClick (App.js:15)
    at HTMLUnknownElement.callCallback (react-dom.development.js:540)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:579)
    at Object.invokeGuardedCallback (react-dom.development.js:436)
    at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:450)
    at executeDispatch (react-dom.development.js:834)
    at executeDispatchesInOrder (react-dom.development.js:856)
    at executeDispatchesAndRelease (react-dom.development.js:954)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:965)
    at Array.forEach (<anonymous>)
    at forEachAccumulated (react-dom.development.js:933)
    at processEventQueue (react-dom.development.js:1105)
    at runEventQueueInBatch (react-dom.development.js:3600)
    at handleTopLevel (react-dom.development.js:3609)
    at handleTopLevelImpl (react-dom.development.js:3340)
    at batchedUpdates (react-dom.development.js:11066)
    at batchedUpdates (react-dom.development.js:2323)
    at dispatchEvent (react-dom.development.js:3414)

Although I see that it's implemented: https://github.com/gabrielbull/react-desktop/blob/master/src/textInput/macOs/textInput.js#L146

@CoderableOfficial
Copy link
Collaborator

Hey Thank You For Sharing The Issue. We Will Reach Out To You Soon. And Sorry For The Delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants