Skip to content

The prop onClick cannot trigger on mobile Safari #13

Open
@Xing-He

Description

@Xing-He

Event Click just cannot trigger on mobile safari , and it may be changed to touch Event

and i did some change.

    const videoProps = {
      ref: v => this.video = v,
      src: typeof this.props.src === 'string' ? this.props.src : null,
      preload: this.props.preload,
      poster: this.props.poster,
      muted: this.props.muted,
      loop: this.props.loop,
+      onTouchStart:this.props.onClick,
      onTimeUpdate: this._handleTimeUpdate,
      onEnded: this._handleVideoEnd,
      ...Object.assign(this.props.extraVideoElementProps, { playsInline: this.props.playsInline })
    };

    return (
      <div
        ref={r => this.container = r}
        className={`BackgroundVideo ${this.props.className}`}
        style={Object.assign({ ...absolute100, visibility }, this.props.style)}
-      onClick={this.props.onClick}
+        // onClick={this.props.onClick}
        onKeyPress={this.props.onKeyPress}
        tabIndex={this.props.tabIndex}
      >

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions