Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
onFocus y onBlur no se procesan en reaccionar

Tengo el siguiente código

 <ElementsBasket name="nextActionDate" data={this.props.newLead.get("actions").get("nextActionDate")} > <div className="form-group"> <span className="glyphicon glyphicon-calendar">Calendar </span> <span className="glyphicon glyphicon-triangle-bottom"></span> <input type="text" className="form-control" onFocus={(this.type = "date")} onBlur={(this.type = "text")} placeholder="Enter your date here." value={this.props.newLead.get("actions").get("nextActionDate")} onChange={onFieldChanged.bind(this, "actions.nextActionDate")} /> </div> </ElementsBasket>;

En la etiqueta de entrada, estoy tratando de que aparezca un texto de marcador de posición en el campo de entrada de forma predeterminada, y cuando se hace clic, me gustaría que el tipo se cambie como fecha. Y el problema parece ser cuando se hace clic en el elemento de inspección en Chrome. No mostraría onFocus y onBlur .

P/S: Incluso el onClick parece tener el mismo problema

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

¿Es esto lo que estás buscando?

http://codepen.io/comakai/pen/WvzRKp?editors=001

 var Foo = React.createClass({ getInitialState: function () { return { type: 'text' }; }, onFocus: function () { this.setState({ type: 'date' }); }, onBlur: function () { this.setState({ type: 'text' }); }, render: function () { return( <input type={ this.state.type } onFocus={ this.onFocus } onBlur={ this.onBlur } placeholder="Enter your date here." /> ) } }); React.render(<Foo/>, document.body);

Como he comentado anteriormente, el método de renderizado se activa la primera vez y después de eso en cada cambio de estado (y si shouldComponentRender devuelve verdadero en caso de que esté implementado):

https://facebook.github.io/react/docs/component-specs.html

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!