-
Notifications
You must be signed in to change notification settings - Fork 298
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
Enable horizontal scrolling of ScrollView from RN #121
Conversation
maybe also fixes #41 |
@@ -1,6 +1,5 @@ | |||
import React from 'react'; | |||
import { StyleSheet, Text, View, Dimensions, TextInput } from 'react-native'; | |||
import { ScrollView } from 'react-native-gesture-handler'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iirc I used the ScrollView from RNGH because the one from react native wasn't working on Android. Have you been able to make it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know,
minDist={20}
activeOffsetY={20}
activeOffsetX={20}
this fixed ScrollView from RN, check examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use react-native-tab-view
inside modalize, these changes make tabs work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird, I've been running your code locally and I wasn't able to scroll. I was running the expo example though. I will give react-navigation a try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the other scroll view under that you didn't try, which is a vertical scroll view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, nested vertical RN ScrollView doesn't work on android, but maybe we can document this somehow, smth like, if you want to vertical scroll view inside vertical scroll view on android (that's antipattern, imho), please use ScrollView from RNGH! I think, support of others libraries that use horizontal ScrollView from RN is more important!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, wait, need to try https://facebook.github.io/react-native/docs/scrollview#nestedscrollenabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it doen't helps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
src/index.tsx
Outdated
@@ -86,7 +86,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C | |||
|
|||
const fullHeight = isIos | |||
? screenHeight | |||
: screenHeight - (isIos ? StatusBar.currentHeight || 0 : 10); | |||
: screenHeight - (StatusBar.currentHeight || 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't even notice I added isIos where it's already checked before.
Anyway, I did that by design because I find the Android margin too important. Could we expose that in a prop? I will be happy and not rechange again after merging your changes :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add a prop smth like topOffset
? What do you think? By default it will be ios: 0, adnroid: StatusBar.currentHeight || 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the name of the prop! topMargin
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm fine with these default value. I would say modalTopOffset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will do
…#121) * fix: tap on text input clear button on ios * fix: enable nested horizontal scroll (ScrollView from RN) * fix: statusbar.currentheight is available on android only * fix: avoid_keyboard_like_ios should be false on android by default * feat: modal top offset prop
Also contains several fixes