简体   繁体   中英

How to make button sticky to the bottom inside ScrollView in react native?

As per the solution given on other answers, to place the sticky content outside the scrollview. But when I am placing sticky button outide the scrollview and when the soft keyboard popsup, the sticky button pops-up to the top of content as it is not inside scrollView. Ideally button should stick to the bottom even after keyboard pops-up ie it should be behind the keyboard. Please check video in the attached URL.

https://filebin.net/e7ek1zkt9840f9lw

Related snack is:

https://snack.expo.io/qtTC4tvTE

You can use stickyHeaderIndices props to ScrollView. consider your structure is as follows:

     <ScrollView> 
       <View><Text>This is header</Text></View>
       <View><Text>This is body</Text></View>
       <View><Text>This is footer</Text></View>
     </ScrollView>

and if you want to make your footer part sticky then simply put stickyHeaderIndices={[2]} inside scrollview.

      <ScrollView stickyHeaderIndices={[2]}> 
       <View><Text>This is header</Text></View>
       <View><Text>This is body</Text></View>
       <View><Text>This is footer</Text></View>
     </ScrollView>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM