Skip to content

Commit

Permalink
fix scroll for android
Browse files Browse the repository at this point in the history
  • Loading branch information
ohpax committed Mar 14, 2019
1 parent 35a56b8 commit 3990209
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/CNRichTextView.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ class CNRichTextView extends Component {
onLayout={this.onLayout}
style={[styles]}
onStartShouldSetResponder={(evt) => {
this.setState({ isScrolled: false });
setTimeout(this.flip, 100);
this.setState({ isScrolled: false },
() => { setTimeout(this.flip, 100); });

return true;
}}
onResponderMove={(evt) => {
this.setState({ isScrolled: true });
onResponderMove={(evt) => {
var touch = evt.touchHistory.touchBank.find((obj) => obj != undefined && obj != null);
if((touch.startPageY - touch.currentPageY ) > 2 ||
(touch.startPageY - touch.currentPageY ) < -2 ){
this.setState({ isScrolled: true });
} else
{
this.setState({ isScrolled: false });
}
return true;
}}
>
Expand Down

0 comments on commit 3990209

Please sign in to comment.