Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthetic event warning #14

Open
aprilmintacpineda opened this issue Feb 25, 2017 · 5 comments
Open

Synthetic event warning #14

aprilmintacpineda opened this issue Feb 25, 2017 · 5 comments

Comments

@aprilmintacpineda
Copy link

aprilmintacpineda commented Feb 25, 2017

  • React@15.4.2
  • React-Scrollbar-js@1.0.1
Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the property `shiftKey` on a released/nullified synthetic event. This is set to null. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.
import ReactScrollbarJS from 'react-scrollbar-js';

// etc.

// on the render
<div className="post-right">
	<ReactScrollbarJS style={{height: '100%', width: '100%'}}>
		<p className="section-title">You may also like</p>
		{this.props.related_posts.length > 0? this.props.related_posts.map((post, i) =>
			<div className="related-post-wrapper" key={i}>
				<img src={settings.storage_path + '/images/' + post.cover_image} />
				<Link to={'/post/' + post.public_id}>{post.title}</Link>
			</div>
		): <p>There are no related posts to show.</p>}
	</ReactScrollbarJS>
</div>
@usulpro
Copy link
Contributor

usulpro commented Feb 28, 2017

Could you give us details where it appears?

@aprilmintacpineda
Copy link
Author

it appears on first scroll.

@alaindresse
Copy link

@four-eyes-04-04, is there anything in your props.related_posts that could indicate a change ? My proposal in the other thread assumed that the number of related posts would signal a change. But maybe it is the date of the last related post, or something like that. Putting this value as the key for ReactScrollbarJS should trigger a redraw of the scrollbars when related_posts change, and hence showing the scrollbar.

Looking at the code you posted, another thing that comes to my mind is the images. Maybe your list takes less space until the images are loaded. So until the images are loaded, there is no need for a scrollbar, and after the images are loaded, the component is not refreshed. Putting a minimum height in the css for related-post-wrapper could help confirm that this is the issue.

@junedchhipa
Copy link

If anyone is still getting this issue, I had a temporary workaround.
I had to put e.persist() in scroll event of the plugin, which will hide this Synthetic event warning.

@serjo96
Copy link

serjo96 commented Oct 24, 2017

Same problem, on scroll have Synthetic warring
this is live search results
ReactScrollbar and results show if have response elements

renderResults = (item, index) =>{
		return (
			<Link to={'/' + item.media_type + '/' + urlRusLat(item.title || item.name) + '-' + item.id} className="result-element" key={index}>
			<div className="result-element__poster">
				<img src={(item.backdrop_path || item.poster_path) ? 'https://image.tmdb.org/t/p/w45_and_h67_bestv2/' + (item.backdrop_path || item.poster_path) :  NoImg} alt=""/>
			</div>
			<div className="result-element__title">
				<div>{item.title || item.name}</div>
				<div className="result-element__release">{item.release_date ? item.release_date.substring(0, 4) : null}</div>
			</div>
			<div className="result-element__type">{(item.media_type === 'tv') ? 'сериал' : (item.media_type === 'movie') ? 'фильм': 'актер'}</div>
		</Link>
		)};

    return (
         <div className="header__search search" onMouseDown={this.mouseDownHandler} onMouseUp={this.mouseUpHandler}>

             <input className="search__field" type="text" name="Search" placeholder="Поиск фильмов и сериалов..." onKeyDown={this.onKeyDown} onInput={this.onInput} value={this.props.SearchFieldVal}/>
	                {this.state.visabilityResult ?
	                    <div className="search__result searchComboBox">

	                        {this.props.SearchResult.isFetching ?
		                        <ReactScrollbar style={myScrollbar} onScroll={e=>e.persist()}>
			                        {this.props.SearchResult.data.total_results >0 ?
		                        this.props.SearchResult.data.results.map((item, index)=> this.renderResults(item,index))
		                        : <div>Не чего не найдено, уточните запрос</div>}
		                        </ReactScrollbar> : null}
	                      </div> : null}

         </div>
     );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants