react-native-modalbox icon indicating copy to clipboard operation
react-native-modalbox copied to clipboard

Scroll View doesnt scroll if used inside ModalBox

Open gs-akhan opened this issue 8 years ago • 22 comments

The title explains it .

Thanks

gs-akhan avatar Jan 23 '16 14:01 gs-akhan

+1

kinhunt avatar Jan 28 '16 12:01 kinhunt

Hmm I guess there is a conflict with the pan responder. Will check that, thanks for the feedback

maxs15 avatar Jan 28 '16 14:01 maxs15

I could reproduce this issue. For now you have an easy way to make your ScrollView works, just define the swipeArea property. The touches outside of this area will respond to the ScrollView.

maxs15 avatar Jan 28 '16 15:01 maxs15

I would like to implement the possibility to close the modal only if the ScrollView is at the top or reached the end but that's another feature :)

maxs15 avatar Jan 28 '16 15:01 maxs15

@maxs15 tried with swipeToClose={false} swipeArea={0}

problem still exists with ListView inside

kinhunt avatar Jan 29 '16 04:01 kinhunt

Android or IOS ? It worked on my side running on IOS

maxs15 avatar Jan 29 '16 14:01 maxs15

IOS

gs-akhan avatar Jan 29 '16 14:01 gs-akhan

Could you please check with the Example in the project ? Let's take the first Modal as an example, just add the swipeArea property and wrap the content with a ScrollView. You should have something like that:

<Modal style={[styles.modal, styles.modal1]} ref={"modal1"} swipeToClose={this.state.swipeToClose} swipeArea={50} onClosed={this.onClose} onOpened={this.onOpen} onClosingState={this.onClosingState}>
          <ScrollView contentContainerStyle={styles.modal}>
            <Text style={styles.text}>Basic modal</Text>
            <Button onPress={this.toggleSwipeToClose} style={styles.btn}>Disable swipeToClose({this.state.swipeToClose ? "true" : "false"})</Button>
          </ScrollView>
</Modal>

maxs15 avatar Jan 29 '16 15:01 maxs15

Sure will check it out.. Thanks

gs-akhan avatar Feb 07 '16 09:02 gs-akhan

I had a similar issue with this modalbox. I just disabled all handlers of the PanResponder when swipeToClose is false and it worked perfectly. I don't know if thats the correct way but none of these hints helped to solve the problem on my iOS device (iPhone 6). You can review my changes here: https://github.com/BenjaminPaap/react-native-modalbox/commit/4903c1945eeca39dbc1be38db2d66bc01c277fa7

I'm handling the open and close completely manually.

BenjaminPaap avatar Feb 09 '16 12:02 BenjaminPaap

I have to add, that it is not a simple ListView. Instead it is a RefreshableListView (https://github.com/jsdf/react-native-refreshable-listview)

BenjaminPaap avatar Feb 09 '16 12:02 BenjaminPaap

I'll check that as soon as I can, looks like the pan responder stop the propagation on the events

maxs15 avatar Feb 10 '16 19:02 maxs15

There is indeed an issue with a ListView component inside the ModalBox. For now you could just use the swipeArea property, that way the user will only be able to swipe at the top of the modal. I'll plan to integrate the ListView support but I need some time to think about it. Would love to integrate it working the same way as the Pictures modal works on the Facebook app. When you reach the end of the list, it will slide to the top !

maxs15 avatar Feb 18 '16 19:02 maxs15

It's strange that it doesn't respond at all with the ListView. Maybe changing something at contentContainerStyle property of ListView could fix it?

dcflow avatar Feb 22 '16 21:02 dcflow

Mention height for the scrollview it will scroll even with the listview

DurgaManickam avatar Apr 01 '16 12:04 DurgaManickam

I've updated to Example folder with a test using a ScrollView. Everything is working on my side

maxs15 avatar Apr 18 '16 14:04 maxs15

Chipping in that on RN 0.30 using a ListView in the modalBox, @DurgaManickam correctly points out that giving the ListView a height in the style makes the ListView scroll as expected.

Chris-Petty avatar Aug 22 '16 23:08 Chris-Petty

Wrapping the ScrollView inside a View within the Modal should make it work.

azanli avatar Mar 11 '18 03:03 azanli

@maxs15 Thanks for supporting ScrollView, but it only works when the entire modal contents are wrapped with a <ScrollView> component. What if we want just one part of our modal contents to be scrollable?

untitled

farzadso avatar Mar 12 '18 18:03 farzadso

@maxs15 thanks bro, work 💯

herarya avatar May 23 '18 13:05 herarya

Hola, en el modalbox al comienzo de correr la app, me permite el scroll pero luego de soltar no me deja hacer scroll en ninguno de los modales

Dalex96 avatar Jun 05 '18 15:06 Dalex96

Hola, en el modalbox al comienzo de correr la app, me permite el scroll pero luego de soltar no me deja hacer scroll en ninguno de los modales

English bro, use google translate at least... i'll translate it for you this time, i'm argentinian.

"Hi, in modalbox whenever i start the app, it allows me to scroll but after releasing it won't let me scroll in any of the modals that i have"

msqar avatar Jan 26 '19 13:01 msqar