0

I am working on app where I have worked on app header . I have created custom component for header . Now I want to achieve stick header when user scroll down then I want to stick top header . Could someone please help me how to solve this issue .

Code

      <View>
        <Header navigation={navigation} newToken={this.state.token} />
        <SearchBar
          input={(value) => {
            this.onChangeTextDelayed(value);
            this.setState({
              subCategoriesShow: true,
              pharmLoader: true,
              inputValue: value,
              queries: [],
            });
          }}
          handleBlur={() => this.setState({ subCategoriesShow: false })}
        />
      </View>

1 Answer 1

1

You can do it by view and a scroll view.

<View style={{flex: 1, display: 'flex'}}>
    <View>
        <Header {...props}/>
    </View>
    <ScrollView style={{flex: 1}}>
        ... other things
    </ScrollView>
</View>

If this doesn't work you can try with

<ScrollView contentContainerStyle={{flex: 1}}>

instead of

<ScrollView style={{flex: 1}}>
Sign up to request clarification or add additional context in comments.

2 Comments

I just want to stick header , I have other contents too . I want to be stick up with header
@Jonas Maybe there is an issue with your container components. There is a working snack example snack.expo.io/JW7y!BQR_

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.