question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot opening file dialog programmatically on Ipad, Iphone (ios 9, 8.3) with fastclick

See original GitHub issue

Hello. I have this code in my button:

<button className="btn btn-attach" title="Прикрепить изображение" onClick={e => this.openDropzone(e)}>
	<em className="icon material-icons">wallpaper</em>
</button>

and method:

openDropzone(e) {
	e.preventDefault();
	console.log('openDropzone');
	this.dropzone.open();
}

Dropzone ref is ref={(node) => { this.dropzone = node; }} My button place inside Dropzone.

<Dropzone ref={(node) => { this.dropzone = node; }}
	  accept={this.state.dropzone.accept}
	  maxSize={this.state.dropzone.maxSize}
	  multiple={this.state.dropzone.multiple}
	  disableClick={this.state.dropzone.disableClick}
	  name="files"
	  className={dropZoneClasses}
	  onDrop={e => this.onDrop(e)}
	  onDropRejected={e => this.onDropRejected(e)}
	  onDragEnter={e => this.onDragEnter(e)}
	  onDragLeave={e => this.onDragLeave(e)}>
	<div className="content-control__textarea">
		...
		<div className="content-control__panel">
			<button type="submit" className={submitClasses} disabled={!this.state.valid}>Отправить</button>
			<button className="btn btn-attach" type="button" title="Прикрепить изображение" onClick={e => this.dropzone.open()}>
				<em className="icon material-icons">wallpaper</em>
			</button>
			<button className="btn btn-attach" type="button" title="Прикрепить файлы" onClick={e => this.dropzone.open()}>
				<em className="icon icon-paper-clip"/>
			</button>
		</div>
	</div>
</Dropzone>

But dialog not opening on mobile devices. How I can fix it?

"react": "^15.3.2",
"react-dropzone": "^3.13.0",
"react-fastclick": "^3.0.2-alpha.1",

update: If I disable react-fastclick - all work properly

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16

github_iconTop GitHub Comments

2reactions
fredehhcommented, Sep 29, 2017

@rkmarks It corresponds to the code in the example. The issue is that it does not work in my webview android application. It seems that the refDropzone.open does not work.

const FileUploadZone = ({onUpload, accept, ...props}) => {
  let refDropzone;

  return (
    <DropzoneWrapper {...props}>
      <Dropzone
        className='pa3'
        onDrop={files => onUpload(files[0])}
        multiple={false}
        disableClick
        ref={(node) => { refDropzone = node; }}
        accept={accept}
      >
        <div>{i18next.t('button.dragDrop')}</div>
        <SimpleButton onClick={() => refDropzone.open()}>{i18next.t('button.orSelect')}</SimpleButton>
      </Dropzone>
    </DropzoneWrapper>
  );
};
0reactions
stale[bot]commented, Nov 30, 2017

This issue has been automatically marked as stale because it has not had recent activity in the past 60 days. It will be closed if no further activity occurs. If the problem persists please comment here to bump your issue. Thank You - React Dropzone Maintaners

Read more comments on GitHub >

github_iconTop Results From Across the Web

Input click can't be triggered programanticly on iOS <12
I'm having an issue with triggering the opening of a file dialogue on older iOS devices, specifically, the issue seems to be on...
Read more >
View and modify files and folders in Files on iPad
In the Files app , view and modify your documents, images, and other files. Browse and open files and folders. Tap Browse at...
Read more >
About the 'Trust This Computer' alert on your iPhone, iPad, or ...
When you connect your iPhone, iPad, or iPod touch to a computer or other device for the first time, an alert asks whether...
Read more >
iOS update and restore errors - Apple Support
Learn how to solve iOS update and restore errors.
Read more >
If an app on your iPhone or iPad stops responding, closes ...
Close and reopen the app. Force the app to close. Then open the app to see if it's working as expected. Restart your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found