react-native-sticky-parallax-header:sticky-parallax-header是一个RN三方库,需要在鸿蒙RN上可用,达到在安卓和IOS上的使用效果,满足应用跨端开发的需求。             

sticky-parallax-header是一个RN三方库,需要在鸿蒙RN上可用,达到在安卓和IOS上的使用效果,满足应用跨端开发的需求。             

Branch4Tags5

Document Template: v0.4.2

react-native-sticky-parallax-header

English | 简体中文

This project is based on react-native-sticky-parallax-header.

This third-party library has been migrated to AtomGit and is now available for direct download from npm, the new package name is: @react-native-ohos/react-native-sticky-parallax-header, the version correspondence details are as follows:

Name Version(Npm Address) Release Information Supported RN Version Supported Autolink Compile API Version Community Baseline Version Source code address
@react-native-ohos/react-native-sticky-parallax-header ~ 1.3.0 AtomGit Releases 0.82.* No API12+ 1.0.0 br_rnoh0.82
@react-native-ohos/react-native-sticky-parallax-header ~ 1.2.0 AtomGit Releases 0.77.* No API12+ 1.0.0 br_rnoh0.77
@react-native-ohos/react-native-sticky-parallax-header ~ 1.1.2 AtomGit Releases 0.72.* No API12+ 1.0.0 br_rnoh0.72
@react-native-oh-tpl/react-native-sticky-parallax-header <= 1.1.1-0.0.1@deprecated GitHub Releases(deprecated) 0.72.* No API12+ 1.0.0 sig

Introduction

react-native-sticky-parallax-header is a sticky parallax header component library that provides Tabbed Header Pager, Tabbed Header List, Details Header, Avatar Header, Custom Sticky Header, and FlashList Headers components.

Installation

Go to the project directory and execute the following instruction:

npm

npm install @react-native-ohos/react-native-sticky-parallax-header

yarn

yarn add @react-native-ohos/react-native-sticky-parallax-header

Dependency Notes

Choose the appropriate third-party library version based on the React Native framework version used in your application. The version mapping is as follows:

RN Framework Version Dependency Library Supported Version Range
0.82 @react-native-ohos/react-native-reanimated >=4.0.0 && < 4.1.0
@react-native-ohos/react-native-safe-area-context >=5.6.5 && < 5.7.0

The implementation of this library depends on the above-mentioned adapted third-party libraries. If they have already been introduced into your application project, you can skip the steps in this chapter and use them directly.

Ensure that the third-party library versions match the RN framework version used in your project. Mismatched versions may cause compilation or runtime errors.

Constraints

Compatibility

This document is verified based on the following versions:

  1. RNOH: 0.82.18; SDK: HarmonyOS 6.0.1 Release SDK; IDE: DevEco Studio 6.0.1 Release; ROM: 6.0.0.120 SP7;

Permission Requirements

No special permission is required.

Example

The following code shows the basic usage scenario of this library:

The import library name remains unchanged during use.

import * as React from "react";
import { StatusBar, View, useColorScheme } from "react-native";
import { TabbedHeaderPager } from "react-native-sticky-parallax-header";

const TabbedHeaderPagerExample: React.FC = () => {
  const isDarkTheme = useColorScheme() === "dark";
  return (
    <>
      <TabbedHeaderPager
        contentContainerStyle={[
          isDarkTheme
            ? screenStyles.darkBackground
            : screenStyles.lightBackground,
        ]}
        containerStyle={screenStyles.stretchContainer}
        backgroundColor={colors.primaryGreen}
        foregroundImage={photosPortraitMe}
        rememberTabScrollPosition
        logo={logo}
        title={"Mornin' Mark! \nReady for a quiz?"}
        titleStyle={screenStyles.text}
        tabs={TABBED_SECTIONS.map((section) => ({
          title: section.title,
        }))}
        tabTextStyle={screenStyles.text}
        showsVerticalScrollIndicator={false}
      >
        <View style={styles.content}>
          {Brandon.cards.map((data, i, arr) => (
            <QuizCard
              data={data}
              num={i}
              key={data.question}
              cardsAmount={arr.length}
            />
          ))}
        </View>
        <View style={styles.content}>
          {Ewa.cards.map((data, i, arr) => (
            <QuizCard
              data={data}
              num={i}
              key={data.question}
              cardsAmount={arr.length}
            />
          ))}
        </View>
        <View style={styles.content}>
          {Jennifer.cards.map((data, i, arr) => (
            <QuizCard
              data={data}
              num={i}
              key={data.question}
              cardsAmount={arr.length}
            />
          ))}
        </View>
        <View style={styles.content}>
          {Brandon.cards.map((data, i, arr) => (
            <QuizCard
              data={data}
              num={i}
              key={data.question}
              cardsAmount={arr.length}
            />
          ))}
        </View>
        <View style={styles.content}>
          {Ewa.cards.map((data, i, arr) => (
            <QuizCard
              data={data}
              num={i}
              key={data.question}
              cardsAmount={arr.length}
            />
          ))}
        </View>
        <View style={styles.content}>
          {Jennifer.cards.map((data, i, arr) => (
            <QuizCard
              data={data}
              num={i}
              key={data.question}
              cardsAmount={arr.length}
            />
          ))}
        </View>
      </TabbedHeaderPager>
      <StatusBar
        barStyle="light-content"
        backgroundColor={colors.primaryGreen}
        translucent
      />
    </>
  );
};

How to Use

Tabbed Header Pager

import * as React from "react";
import { View } from "react-native";
import { TabbedHeaderPager } from "react-native-sticky-parallax-header";

const TabbedHeaderPagerExample: React.FC = () => (
  <TabbedHeaderPager
    backgroundColor={colors.primaryGreen}
    foregroundImage={photosPortraitMe}
    logo={logo}
    title={"Mornin' Mark! \nReady for a quiz?"}
    tabs={TABBED_SECTIONS.map((section) => ({ title: section.title }))}
    tabTextStyle={screenStyles.text}
    showsVerticalScrollIndicator={false}>
    <View style={styles.content}>
      {/* Content of page 1 */}
    </View>
    <View style={styles.content}>
      {/* Content of page 2 */}
    </View>
  </TabbedHeaderPager>
);

Avatar Header

import * as React from "react";
import { View } from "react-native";
import { AvatarHeaderScrollView } from "react-native-sticky-parallax-header";

const AvatarHeaderExample: React.FC = () => (
  <AvatarHeaderScrollView
    leftTopIcon={iconCloseWhite}
    rightTopIcon={IconMenu}
    containerStyle={screenStyles.stretchContainer}
    backgroundColor={Brandon.color}
    hasBorderRadius
    image={Brandon.image}
    subtitle={Brandon.about}
    title={Brandon.author}
    titleStyle={screenStyles.text}
    showsVerticalScrollIndicator={false}>
    <View style={styles.content}>
      {/* List content */}
    </View>
  </AvatarHeaderScrollView>
);

Details Header

import * as React from "react";
import { View } from "react-native";
import { DetailsHeaderScrollView } from "react-native-sticky-parallax-header";

const DetailsHeaderExample: React.FC = () => (
  <DetailsHeaderScrollView
    leftTopIcon={iconCloseWhite}
    rightTopIcon={IconMenu}
    containerStyle={screenStyles.stretchContainer}
    backgroundColor={Brandon.color}
    contentIcon={CardsBlack}
    contentIconNumber={10}
    hasBorderRadius
    image={Brandon.image}
    tag={Brandon.type}
    title={Brandon.author}
    showsVerticalScrollIndicator={false}>
    <View style={styles.content}>
      {/* List content */}
    </View>
  </DetailsHeaderScrollView>
);

Custom Sticky Header

import * as React from "react";
import { ScrollView, View } from "react-native";
import {
  StickyHeaderScrollView,
  useStickyHeaderScrollProps,
} from "react-native-sticky-parallax-header";

const PARALLAX_HEIGHT = 330;
const SNAP_START_THRESHOLD = 50;
const SNAP_STOP_THRESHOLD = 330;

const CustomHeaderExample: React.FC = () => {
  const {
    onMomentumScrollEnd,
    onScroll,
    onScrollEndDrag,
    scrollHeight,
    scrollViewRef,
  } = useStickyHeaderScrollProps<ScrollView>({
    parallaxHeight: PARALLAX_HEIGHT,
    snapStartThreshold: SNAP_START_THRESHOLD,
    snapStopThreshold: SNAP_STOP_THRESHOLD,
    snapToEdge: true,
  });

  return (
    <StickyHeaderScrollView
      ref={scrollViewRef}
      containerStyle={screenStyles.stretchContainer}
      onScroll={onScroll}
      onMomentumScrollEnd={onMomentumScrollEnd}
      onScrollEndDrag={onScrollEndDrag}
      renderHeader={() => (
        <View pointerEvents="box-none" style={{ height: scrollHeight }}>
          {/* Custom header content */}
        </View>
      )}
      renderTabs={() => {
        /* Custom tab bar content */
      }}>
      {/* Page content */}
    </StickyHeaderScrollView>
  );
};

Available APIs

The **Platform** column indicates the platform where the properties are supported in the original third-party library.

If the value of **OpenHarmony Platform Support** is **Yes**, it means that the OpenHarmony platform supports this property; **No** means the opposite; **Partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.

This library provides Tabbed Header Pager, Tabbed Header List, Details Header, Avatar Header, Custom Sticky Header, and FlashList Headers components. The FlashList Headers components are created through the withAvatarHeaderFlashList, withDetailsHeaderFlashList, and withTabbedHeaderFlashList HOCs, whose properties are the same as those of the Avatar Header, Details Header, and Tabbed Header List components respectively.

Components

Name Parameter Type Required Platform OpenHarmony Platform Support Description
TabbedHeaderPager TabbedHeaderPagerProps Yes iOS/Android Yes Tabbed Header Pager component
TabbedHeaderList TabbedHeaderListProps Yes iOS/Android Yes Tabbed Header List component
DetailsHeaderScrollView DetailsHeaderProps Yes iOS/Android Yes Details Header ScrollView component
DetailsHeaderFlatList DetailsHeaderProps Yes iOS/Android Yes Details Header FlatList component
DetailsHeaderSectionList DetailsHeaderProps Yes iOS/Android Yes Details Header SectionList component
AvatarHeaderScrollView AvatarHeaderProps Yes iOS/Android Yes Avatar Header ScrollView component
AvatarHeaderFlatList AvatarHeaderProps Yes iOS/Android Yes Avatar Header FlatList component
AvatarHeaderSectionList AvatarHeaderProps Yes iOS/Android Yes Avatar Header SectionList component
StickyHeaderScrollView StickyHeaderProps Yes iOS/Android Yes Custom Sticky Header ScrollView component
StickyHeaderFlatList StickyHeaderProps Yes iOS/Android Yes Custom Sticky Header FlatList component
StickyHeaderSectionList StickyHeaderProps Yes iOS/Android Yes Custom Sticky Header SectionList component
AvatarHeaderFlashList AvatarHeaderProps Yes iOS/Android Yes Avatar Header FlashList component
DetailsHeaderFlashList DetailsHeaderProps Yes iOS/Android Yes Details Header FlashList component
TabbedHeaderFlashList TabbedHeaderListProps Yes iOS/Android Yes Tabbed Header FlashList component

Properties

TabbedHeaderPagerProps

Properties of the Tabbed Header Pager component, inherits ScrollViewProps.

Name Parameter Type Default Value Required Platform OpenHarmony Platform Support Description
backgroundColor color - ColorValue None No iOS/Android Yes Sets the background color of a component
backgroundImage image source - ImageSourcePropType None No iOS/Android No Sets the background image of the component
containerStyle style - StyleProp None Yes iOS/Android Yes Style the entire component container
disableScrollToPosition boolean None No iOS/Android No Whether to disable sliding
enableSafeAreaTopInset boolean true No iOS/Android Yes Indicates whether to set a security zone
foregroundImage image source - ImageSourcePropType None No iOS/Android Yes Setting the avatar resource
hasBorderRadius boolean None No iOS/Android Yes Whether the upper part is a layout with fillets in the lower right corner
headerHeight number 100 No iOS/Android Yes Sets the header height on the component
initialPage number 0 No iOS/Android Yes Sets the initial page of the lower page of the component
logo image source - ImageSourcePropType None No iOS/Android Yes Set the logo image resource on the top
logoContainerStyle style - StyleProp None No iOS/Android Yes Sets the logo container style
logoResizeMode image resize mode - ImageResizeMode None No iOS/Android Yes Sets the logo resize mode
logoStyle style - StyleProp None No iOS/Android Yes Setting the logo style
onChangeTab function - (prevPage: number, newPage: number) => void None No iOS/Android Yes Tab bar switch callback
onHeaderLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Header layout adjustment callback
onMomentumScrollBegin worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding start event callback
onMomentumScrollEnd worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end event callback
onScroll worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding event callback
onScrollBeginDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Callback of the sliding start drag event
onScrollEndDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end drag event callback
onTabsLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Tab bar layout change event callback
onTopReached function - () => void None No iOS/Android Yes Top event callback
pageContainerStyle style - StyleProp<Animated.AnimateStyle> None No iOS/Android Yes Page Container Style
pagerProps PagerProps & RefAttributes None No iOS/Android No Internal Pager component props and ref, goToPage is currently unavailable due to issue#412
parallaxHeight number responsiveHeight(53) No iOS/Android Yes Parallax height value
rememberTabScrollPosition boolean None No iOS/Android Yes Indicates whether to retain the sliding position of the tab panel.
renderHeaderBar render function None No iOS/Android Yes headerBar Rendering Function
snapStartThreshold number None No iOS/Android Yes Resistance value at the start of sliding
snapStopThreshold number None No iOS/Android No Resistance value at the end of sliding
snapToEdge boolean false No iOS/Android No enabled or not to slide to edge
stickyTabs boolean true No iOS/Android Yes Indicates whether the tab bar can be fixed
tabTextActiveStyle style - StyleProp None No iOS/Android Yes Select a text style on the tab bar
tabTextContainerStyle style - StyleProp None No iOS/Android Yes Tab Bar Text Container Style
tabTextContainerActiveStyle style - StyleProp None No iOS/Android Yes Tab Bar Text Container Selection Style
tabTextStyle style - StyleProp None No iOS/Android Yes Tab Bar Text Style
tabUnderlineColor color - ColorValue None No iOS/Android Yes Color of the horizontal line at the bottom of the tab bar text
tabWrapperStyle style - StyleProp None No iOS/Android Yes Tab Bar Wrap Container Style
tabs Tabs array - Tab[] None No iOS/Android Yes Tab Bar Data Source
tabsContainerBackgroundColor color - ColorValue None No iOS/Android Yes Tab Bar Container Background Color
tabsContainerHorizontalPadding number 20 No iOS/Android Yes Tab Bar Container Horizontal Inner Padding
tabsContainerStyle style - StyleProp None No iOS/Android Yes Tab Bar Container Style
title string None No iOS/Android Yes Title Text
titleStyle style - StyleProp None No iOS/Android Yes Title Text Style
titleTestID string None No iOS/Android Yes Title Test ID

TabbedHeaderListProps

Properties of the Tabbed Header List component, inherits SectionListProps.

Name Parameter Type Default Value Required Platform OpenHarmony Platform Support Description
backgroundColor color - ColorValue None No iOS/Android Yes Sets the background color of a component
backgroundImage image source - ImageSourcePropType None No iOS/Android No Sets the background image of the component
containerStyle style - StyleProp None Yes iOS/Android Yes Style the entire component container
enableSafeAreaTopInset boolean true No iOS/Android Yes Indicates whether to set a security zone
foregroundImage image source - ImageSourcePropType None No iOS/Android Yes Setting the avatar resource
hasBorderRadius boolean None No iOS/Android Yes Whether the upper part is a layout with fillets in the lower right corner
headerHeight number 100 No iOS/Android Yes Sets the header height on the component
logo image source - ImageSourcePropType None No iOS/Android Yes Set the logo image resource on the top
logoContainerStyle style - StyleProp None No iOS/Android Yes Sets the logo container style
logoResizeMode image resize mode - ImageResizeMode None No iOS/Android Yes Sets the logo resize mode
logoStyle style - StyleProp None No iOS/Android Yes Setting the logo style
onHeaderLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Header layout adjustment callback
onMomentumScrollBegin worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding start event callback
onMomentumScrollEnd worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end event callback
onScroll worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding event callback
onScrollBeginDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Callback of the sliding start drag event
onScrollEndDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end drag event callback
onTabsLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Tab bar layout change event callback
onTopReached function - () => void None No iOS/Android Yes Top event callback
parallaxHeight number responsiveHeight(53) No iOS/Android Yes Parallax height value
renderHeaderBar render function None No iOS/Android Yes headerBar Rendering Function
snapStartThreshold number None No iOS/Android Yes Resistance value at the start of sliding
snapStopThreshold number None No iOS/Android No Resistance value at the end of sliding
snapToEdge boolean false No iOS/Android No enabled or not to slide to edge
stickyTabs boolean true No iOS/Android Yes Indicates whether the tab bar can be fixed
tabTextActiveStyle style - StyleProp None No iOS/Android Yes Select a text style on the tab bar
tabTextContainerStyle style - StyleProp None No iOS/Android Yes Tab Bar Text Container Style
tabTextContainerActiveStyle style - StyleProp None No iOS/Android Yes Tab Bar Text Container Selection Style
tabTextStyle style - StyleProp None No iOS/Android Yes Tab Bar Text Style
tabUnderlineColor color - ColorValue None No iOS/Android Yes Color of the horizontal line at the bottom of the tab bar text
tabWrapperStyle style - StyleProp None No iOS/Android Yes Tab Bar Wrap Container Style
tabs Tabs array - Tab[] None No iOS/Android Yes Tab Bar Data Source
tabsContainerBackgroundColor color - ColorValue None No iOS/Android Yes Tab Bar Container Background Color
tabsContainerHorizontalPadding number 20 No iOS/Android Yes Tab Bar Container Horizontal Inner Padding
tabsContainerStyle style - StyleProp None No iOS/Android Yes Tab Bar Container Style
title string None No iOS/Android Yes Title Text
titleStyle style - StyleProp None No iOS/Android Yes Title Text Style
titleTestID string None No iOS/Android Yes Title Test ID

DetailsHeaderProps

Shared properties of the DetailsHeaderScrollView, DetailsHeaderFlatList, and DetailsHeaderSectionList components.

Name Parameter Type Default Value Required Platform OpenHarmony Platform Support Description
backgroundColor color - ColorValue None No iOS/Android Yes Sets the background color of a component
backgroundImage image source - ImageSourcePropType None No iOS/Android No Sets the background image of the component
containerStyle style - StyleProp None Yes iOS/Android Yes Style the entire component container
contentIcon image source - ImageSourcePropType None No iOS/Android Yes Icon on the card on the left of the avatar
contentIconNumber number None No iOS/Android Yes Number on the card on the left of the avatar
contentIconNumberStyle style - StyleProp None No iOS/Android Yes Number style of the card on the left of the avatar
contentIconNumberTestID string None No iOS/Android Yes Test ID
enableSafeAreaTopInset boolean true No iOS/Android Yes Indicates whether to set a security zone
leftTopIcon render function or image source - ImageSourcePropType None No iOS/Android Yes Sets the logo on the left of the head
leftTopIconAccessibilityLabel string None No iOS/Android No Sets the auxiliary logo label on the left of the head
leftTopIconOnPress function - () => void None No iOS/Android Yes Callback of the logo click event on the left of the header
leftTopIconTestID string None No iOS/Android Yes Logo test ID on the left of the head
hasBorderRadius boolean None No iOS/Android Yes Whether the upper part is a layout with fillets in the lower right corner
headerHeight number 100 No iOS/Android Yes Sets the header height on the component
image image source - ImageSourcePropType None No iOS/Android Yes Character avatar image resources
onHeaderLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Header layout adjustment callback
onMomentumScrollBegin worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding start event callback
onMomentumScrollEnd worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end event callback
onScroll worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding event callback
onScrollBeginDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Callback of the sliding start drag event
onScrollEndDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end drag event callback
onTabsLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Tab bar layout change event callback
onTopReached function - () => void None No iOS/Android Yes Top event callback
parallaxHeight number responsiveHeight(53) No iOS/Android Yes Parallax height value
renderHeaderBar render function None No iOS/Android Yes headerBar Rendering Function
rightTopIcon render function or image source - ImageSourcePropType None No iOS/Android Yes Sets the icon on the right of the head
rightTopIconAccessibilityLabel string None No iOS/Android No Sets the auxiliary icon label on the right of the head
rightTopIconOnPress function - () => void None No iOS/Android Yes Callback of the icon click event on the right of the header
rightTopIconTestID string None No iOS/Android Yes Icon test ID on the right of the head
snapStartThreshold number None No iOS/Android Yes Resistance value at the start of sliding
snapStopThreshold number None No iOS/Android No Resistance value at the end of sliding
snapToEdge boolean false No iOS/Android No enabled or not to slide to edge
stickyTabs boolean true No iOS/Android Yes Indicates whether the tab bar can be fixed
subtitle string None No iOS/Android Yes SubTitle Text
subtitleStyle style - StyleProp None No iOS/Android Yes SubTitle Text Style
subtitleTestID string None No iOS/Android Yes SubTitle Text Test ID
tabsContainerBackgroundColor color - ColorValue None No iOS/Android Yes Tab Bar Container Background Color
tag string None No iOS/Android Yes Tag Text
tagStyle style - StyleProp None No iOS/Android Yes Tag Text Style
tagTestID string None No iOS/Android Yes Tag Text Test ID
title string None No iOS/Android Yes Title Text
titleStyle style - StyleProp None No iOS/Android Yes Title Text Style
titleTestID string None No iOS/Android Yes Title Test ID

AvatarHeaderProps

Shared properties of the AvatarHeaderScrollView, AvatarHeaderFlatList, and AvatarHeaderSectionList components.

Name Parameter Type Default Value Required Platform OpenHarmony Platform Support Description
backgroundColor color - ColorValue None No iOS/Android Yes Sets the background color of a component
backgroundImage image source - ImageSourcePropType None No iOS/Android No Sets the background image of the component
containerStyle style - StyleProp None Yes iOS/Android Yes Style the entire component container
enableSafeAreaTopInset boolean true No iOS/Android Yes Indicates whether to set a security zone
leftTopIcon render function or image source - ImageSourcePropType None No iOS/Android Yes Sets the logo on the left of the head
leftTopIconAccessibilityLabel string None No iOS/Android No Sets the auxiliary logo label on the left of the head
leftTopIconOnPress function - () => void None No iOS/Android Yes Callback of the logo click event on the left of the header
leftTopIconTestID string None No iOS/Android Yes Logo test ID on the left of the head
hasBorderRadius boolean None No iOS/Android Yes Whether the upper part is a layout with fillets in the lower right corner
headerHeight number 100 No iOS/Android Yes Sets the header height on the component
image image source - ImageSourcePropType None No iOS/Android Yes Character avatar image resources
onHeaderLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Header layout adjustment callback
onMomentumScrollBegin worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding start event callback
onMomentumScrollEnd worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end event callback
onScroll worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding event callback
onScrollBeginDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Callback of the sliding start drag event
onScrollEndDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end drag event callback
onTabsLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Tab bar layout change event callback
onTopReached function - () => void None No iOS/Android Yes Top event callback
parallaxHeight number responsiveHeight(53) No iOS/Android Yes Parallax height value
renderHeaderBar render function None No iOS/Android Yes headerBar Rendering Function
rightTopIcon render function or image source - ImageSourcePropType None No iOS/Android Yes Sets the icon on the right of the head
rightTopIconAccessibilityLabel string None No iOS/Android No Sets the auxiliary icon label on the right of the head
rightTopIconOnPress function - () => void None No iOS/Android Yes Callback of the icon click event on the right of the header
rightTopIconTestID string None No iOS/Android Yes Icon test ID on the right of the head
snapStartThreshold number None No iOS/Android Yes Resistance value at the start of sliding
snapStopThreshold number None No iOS/Android No Resistance value at the end of sliding
snapToEdge boolean false No iOS/Android No enabled or not to slide to edge
stickyTabs boolean true No iOS/Android Yes Indicates whether the tab bar can be fixed
subtitle string None No iOS/Android Yes SubTitle Text
subtitleStyle style - StyleProp None No iOS/Android Yes SubTitle Text Style
subtitleTestID string None No iOS/Android Yes SubTitle Text Test ID
tabsContainerBackgroundColor color - ColorValue None No iOS/Android Yes Tab Bar Container Background Color
title string None No iOS/Android Yes Title Text
titleStyle style - StyleProp None No iOS/Android Yes Title Text Style
titleTestID string None No iOS/Android Yes Title Test ID

StickyHeaderProps

Shared properties of the StickyHeaderScrollView, StickyHeaderFlatList, and StickyHeaderSectionList components.

Name Parameter Type Default Value Required Platform OpenHarmony Platform Support Description
containerStyle style - StyleProp None Yes iOS/Android Yes Style the entire component container
onHeaderLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Header layout adjustment callback
onMomentumScrollBegin worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding start event callback
onMomentumScrollEnd worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end event callback
onScroll worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding event callback
onScrollBeginDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Callback of the sliding start drag event
onScrollEndDrag worklet function - (e: NativeScrollEvent) => void None No iOS/Android Yes Sliding end drag event callback
renderHeader render function None No iOS/Android Yes header rendering function
renderTabs render function None No iOS/Android Yes tab rendering function
stickyTabs boolean true No iOS/Android Yes Indicates whether the tab bar can be fixed
onTopReached function - () => void None No iOS/Android Yes Top event callback
onTabsLayout function - (e: LayoutChangeEvent) => void None No iOS/Android Yes Tab bar layout change event callback

API

Name Type Parameter Type Return Value Required Platform OpenHarmony Platform Support Description
goToPage function number void No iOS/Android No Jumps to the specified page

Known Issues

  • Some properties of the TabbedHeaderPager component in the original library do not take effect: issue#415
  • Some properties of the DetailsHeader and AvatarHeader components in the original library do not take effect: issue#416
  • The ref.current.goToPage method in the original library does not exist: issue#412

Other

None

Directory Structure

/react-native-sticky-parallax-header  # Project root directory
├── src                              # Component source code
│   └── index.tsx                    # Entry file
├── example                          # Example project
├── docs                             # Documentation
├── COMMITTERS.md                    # Committer list
├── LICENSE                          # Open source license file
├── OAT.xml                          # OAT self-check configuration
├── README.OpenSource                # Open source information
├── README.md                        # Chinese installation and usage guide
├── README_en.md                     # English installation and usage guide
└── package.json                     # Package configuration

How to Contribute

If you find any problem when using react-native-sticky-parallax-header, submit an issue or a PR.

License

This project is based on The MIT License (MIT). Please feel free to enjoy and participate in open source.

Introduction

sticky-parallax-header是一个RN三方库,需要在鸿蒙RN上可用,达到在安卓和IOS上的使用效果,满足应用跨端开发的需求。

Customize your domain