Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

autofocus is not working in react native

import React, { useRef, useEffect } from "react";

export default function SignIn() {
  const inputElement = useRef(null);
  useEffect(() => {
    if (inputElement.current) {
      inputElement.current.focus();
    }
  }, []);

  return (
    <div>
        <form action="...">
            <input
                  ref={inputElement} // yes, this is working in Chrome on Mac 
                  type="text" // allows username also; type 'email' woud insist on '@' sign
                  name="email"
                  placeholder="Email address"
                  autoComplete="email"
                  required
                  ...
                />
        </form>
    </div>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: why we use $ in jquery 
Javascript :: flatlist react native horizontal 
Javascript :: spotify player react 
Javascript :: javascript error handling 
Javascript :: base 8 number javascript 
Javascript :: print a number with commas as thousands separator 
Javascript :: assign values to array in javascript 
Javascript :: rest operator in javascript 
Javascript :: mongoose find by nested property 
Javascript :: sum of a sequence 
Javascript :: js toggle div 
Javascript :: javascript advanced concepts 
Javascript :: javaScript Math.log() Method 
Javascript :: react map list render dictionary 
Javascript :: close browser tab using jquery 
Javascript :: && in javascript 
Javascript :: regex javascript matching first letter to last 
Javascript :: angular tooltip text ngif 
Javascript :: how-to-close-current-tab-in-a-browser-window 
Javascript :: how to create module in react 
Javascript :: set twig variable from javascript 
Javascript :: javascript page loader 
Javascript :: javascript round big numbers 
Javascript :: import json file in the same directory as javascript 
Javascript :: #{10000000000000000000000000000000000} js 
Python :: matplotlib change thickness of line 
Python :: draw a single pixel using pygame 
Python :: install reportlab python 
Python :: how to return PIL image from opencv 
Python :: plotly not showing in jupyter 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =