select value on focus

Summary: select the value of any input element once the field gets focus.

Reviewed By: emilsjolander

Differential Revision: D7009723

fbshipit-source-id: e1bc0f4b219958d8bdb79ef1a583cad86157b050
This commit is contained in:
Daniel Büchele
2018-02-16 07:19:55 -08:00
committed by Facebook Github Bot
parent 269619a419
commit c5371aca64

View File

@@ -36,6 +36,7 @@ export default (props: Props<*>) => {
{...props}
onChange={e => props.onChange(props.property, e.target.value)}
placeholder="undefined"
onFocus={e => e.target.select()}
value={Number.isNaN(props.value) ? '' : props.value}
/>
);