Changeset 64dc53b for components/RegisterScreen.jsx
- Timestamp:
- 06/11/22 23:50:19 (2 years ago)
- Branches:
- main
- Children:
- 4a1a3ca
- Parents:
- 87614a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
components/RegisterScreen.jsx
r87614a5 r64dc53b 2 2 3 3 import { useSelector, useDispatch } from 'react-redux' 4 5 import { useRef } from 'react' 4 6 5 7 import { setStyle } from '../redux/reducers/styleSlice'; … … 8 10 9 11 const RegisterScreen = () => { 12 const ref = useRef(null); 13 10 14 const dispatch = useDispatch(); 11 15 12 16 const styleState = useSelector(state => state.style); 17 18 setTimeout(() => { 19 if (styleState.style.displayRegisterScreen && styleState.style.registerScreenInfo.setFocus) { 20 ref.current.focus(); 21 dispatch(setStyle({ 22 ...styleState.style, 23 registerScreenInfo: { 24 ...styleState.style.registerScreenInfo, 25 setFocus: false 26 } 27 })) 28 } 29 }, 10); 13 30 14 31 function onChangeUsername(e) { … … 40 57 } 41 58 })) 59 } 60 61 function keyUp(e) { 62 if (e.key === 'Enter') { 63 register(); 64 } 42 65 } 43 66 … … 89 112 status: 'success', 90 113 }, 114 inlineAlertText: '', 91 115 })); 92 116 } … … 107 131 <div> 108 132 <span>Username:</span> 109 <input type="text" onChange={(e) => {onChangeUsername(e)}} value={styleState.style.registerScreenInfo.username}/>133 <input ref={ref} type="text" onChange={(e) => {onChangeUsername(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.registerScreenInfo.username} placeholder="your username..."/> 110 134 <span>Display Name:</span> 111 <input type="text" onChange={(e) => {onChangeDisplayName(e)}} value={styleState.style.registerScreenInfo.displayName}/>135 <input type="text" onChange={(e) => {onChangeDisplayName(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.registerScreenInfo.displayName} placeholder="your display name..."/> 112 136 <span>Password:</span> 113 <input type="password" onChange={(e) => {onChangePassword(e)}} value={styleState.style.registerScreenInfo.password}/>137 <input type="password" onChange={(e) => {onChangePassword(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.registerScreenInfo.password} placeholder="your password..."/> 114 138 <div style={{width: '100%', display: 'flex', flexDirection: 'row', justifyContent: 'space-between'}}> 115 139 <button className="primaryButton" onClick={() => closeForm()}>Close Form</button>
Note:
See TracChangeset
for help on using the changeset viewer.