-
Notifications
You must be signed in to change notification settings - Fork 18
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
[table] Android scroll conflict #9
Comments
@Runtime007 To help you, I will need you to produce a minimal reproducible example, in the form of an expo snack or git repository. Also, I am not sure about the issue! |
hi, @jsamr, this issue has troubled me several days. I try to fix it by setting protected static class RNCWebView extends WebView implements LifecycleEventListener {
...
float startX = 0;
float startY = 0;
float dx = 0;
float dy = 0;
@Override
public boolean onTouchEvent(MotionEvent event){
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
getParent().requestDisallowInterceptTouchEvent(true);
startX = event.getX();
startY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
dx = Math.abs(event.getX() - startX);
dy = Math.abs(event.getY() - startY);
if (dx > dy) {
getParent().requestDisallowInterceptTouchEvent(true);
} else {
getParent().requestDisallowInterceptTouchEvent(false);
}
break;
}
return super.onTouchEvent(event);
}
...
} |
@Runtime007 I'll take a look today! |
@Runtime007 The issue is that you would like a minimum dy value for the gesture to trigger a scroll event in the root ScrollView component. Something like the I see two options :
In either cases, you will need I hope you'll find something workable. I will close because this limitation is broadly from react-native. But if you dig any workaround, please post your findings! Best, JSR |
Third option : I would suggest you offer a PR to |
Thank you very much for your proposals, I'll check and try, to see if it can be implemented on the react side. Best regards. |
#14 merged, now you can use onMessage and injectedJavaScript webview props you can disable scroll of ScrollView with scrollEnabled prop <ScrollView scrollEnabled={this.state.scrollEnabled}>
<HTML
alterNode={alterNode}
renderers={this.htmlRenderers}
ignoredTags={IGNORED_TAGS}
html={this.state.content}
/>
</ScrollView> scrollTimer;
onTableMessage = (event) => {
if (event.data === 'scroll') {
if (this.scrollTimer) {
clearTimeout(this.scrollTimer);
}
this.setState({scrollEnabled: false}, () => {
this.scrollTimer = setTimeout(() => {
this.setState({scrollEnabled: true});
}, 100);
});
}
};
htmlRenderers = {
table: makeTableRenderer({
WebViewComponent: WebView,
webViewProps: {
onMessage: this.onTableMessage,
injectedJavaScript:
"setTimeout(() => {document.addEventListener('scroll', function () {window.ReactNativeWebView.postMessage('scroll');},true);}, 300);",
},
}),
}; |
In Android, if Html in ScrollView and table's columns > 2, it's not easy to scroll table to the left to show other columns. iOS is OK.
The text was updated successfully, but these errors were encountered: