- {
- this.props.showUploadButton &&
-
- }
- {
- this.props.showUploadButton &&
+ const localAndQrAttachment = [
+
this.addFile(file)} />,
+
+ ]
+
+ const qrOnlyAttachment = [
+
+ ]
+
+ const buttonAttachment =
+ [
+ ,
implements ShellFunct
role="button"
capture={!!this.props.uploadCapture}
accept={this.props.uploadCapture}
- />
- }
- {
- this.props.showUploadButton &&
+ />,
- }
-
-{this.props.showAutoSuggest ? (
- {
- this.sendMessage(selection)
- return
- }}
- onInputValueChange={(inputValue) => {
- if(this.props.autoSuggestType === "static") {
- return
- }
- this.props.onChangeText(inputValue)
- return
- }}
- itemToString={(item) => {
- return item ? item : "";
- }}
- >
- {({
- getInputProps,
- getItemProps,
- getMenuProps,
- isOpen,
- inputValue,
- highlightedIndex,
- selectedItem,
- getRootProps,
- }) => (
-
- )}
-
-
- ) : (
-
-
)}
+ this.props.onChangeText(inputValue)
+ return
+ }}
+ itemToString={(item) => {
+ return item ? item : "";
+ }}
+ >
+ {({
+ getInputProps,
+ getItemProps,
+ getMenuProps,
+ isOpen,
+ inputValue,
+ highlightedIndex,
+ selectedItem,
+ getRootProps,
+ }) => (
+
+
(this.textInput = input)}
+ autoFocus
+ value={this.props.inputText}
+ onBlur={async () => {
+ if(this.props.autoSuggestType === "static") {
+ return this.props.onChangeText("");
+ }
+ }}
+ onKeyPress={(e) => {
+ this.onKeyPress(e);
+ }}
+ onKeyUp={this.autoSuggestOnKeyUp}
+ onFocus={() => this.onTextInputFocus()}
+ placeholder={placeholder}
+ disabled={this.props.disableInput}
+ aria-label={this.props.inputText ? null : placeholder}
+ aria-live="polite"
+ {...getInputProps()}
+ />
+
+ {isOpen
+ ? Array.from(fuzzysort.go(inputValue, (this.props.autoSuggestItems.length > 0
+ ? this.props.autoSuggestItems
+ : this.state.items), {keys: ["answer"], limit: 10}))
+ .reverse()
+ .map((item: any, index: number) => {
+ return -
+ {item.obj.answer}
+
+ })
+ : null}
+
+
+ )}
+
+
+ const defaultInput =
+
+
+
+ return (
+
+ {
+ this.props.showUploadButton && (this.props.uploadUsingQrCodeOnly ? qrOnlyAttachment : this.props.uploadUsingDndAndQrCode ? localAndQrAttachment : buttonAttachment)
+ }
+
+ {this.props.showAutoSuggest ? autosuggestInput : defaultInput}