Home > Enterprise >  How to make sticky footer with react native scrollview?
How to make sticky footer with react native scrollview?

Time:01-31

I Had this code with sticky component on the header, how can i move this to the bottom, like footer button on instagram (when you open the app, it already stick in the bottom) ? here's my code

function MyApp() {
    return (
<ScrollView
   stickyHeaderIndices={[0]}
   showsVerticalScrollIndicator={false}>

      <View>
         <MyStickyFooter/>
      </View>

       <View>
         <Text> Hello world </Text>
         <Text> 3000 long lorem word </Text>
      </View>

</ScrollView>)}


    const MyStickyFooter = () => {
    
      return (
    <View style={{}}>
           <Button> I am a sticky footer </Button>
    </View>
    
    )};

CodePudding user response:

You should move out the MyStickyFooter component from your ScrollView.

You should have something like this:

<View style={....}>
  <ScrollView>
     ... components
  </ScrollView>
  <MyStickyFooter/>
</View>
  •  Tags:  
  • Related