Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/turker0/header

A header library for react-native. Uses power of ReAnimated 2.
https://github.com/turker0/header

animation header mobile react-native reanimated2

Last synced: about 2 months ago
JSON representation

A header library for react-native. Uses power of ReAnimated 2.

Awesome Lists containing this project

README

        

# @oguzturker8/header

A header library for react-native. Uses power of reanimated2.

## Installation

```sh
npm install @oguzturker8/header
```

## Usage

### Basic Header Usage

##### Navigation.tsx

```js
import Header from '@oguzturker8/header';

// ...

// ....

// ...
,
}}
/>
// ...

;

// ...
```

### Header Scroll Animation

##### Navigation.tsx

```js
import Header from '@oguzturker8/header';

// ...

// ....

// ...
(
//
// ),
// }}
/>
// ...

;

// ...
```

##### Screen4.tsx

```js
import {
AnimatedScrollView,
Header,
useHeaderAnimation,
} from '@oguzturker8/header';

function Screen4({ navigation }: screenNavigation) {
const { scrollOffset, scrollHandler } = useHeaderAnimation();
React.useLayoutEffect(() => {
navigation.setOptions({
header: (props) => (

),
});
}, [navigation]);

return (


Screen4
navigation.popToTop()} />
Screen4
{Array.from({ length: 100 }, (_, i) => (
{`${i + 1}. Text`}
))}


);
}
```

### Properties

#### Header

| Prop | Description | Type |
| :-------: | :--------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: |
| style | Header container style prop.
Includes 5 parts
leftStyle
rightStyle
centerStyle
wrapperStyle
titleStyle | leftStyle?: ViewStyle
rightStyle?: ViewStyle
centerStyle?: ViewStyle
wrapperStyle?: ViewStyle
titleStyle?: TextStyle |
| title | Header title text | string |
| type | Decides left and right parts' types | LeftType = 'back' - 'close'
RightType = 'back' - 'close' |
| callback | Parts' onPress callbacks | onLeft?: () => any
onRight?: () => any
onCenter?: () => any |
| size | Parts' text sizes | left?: number
right?: number
center?: number |
| animation | Header animations | Described below section |

#### Animation

| Animations | Description | Type |
| :--------: | :--------------------------------------------------------------------------------: | :----------------------------------------------: |
| background | Header backgroundColor interpolation animation based on ScrollView's scrollOffset. | colorRange: string[]
slidingRange: string[] |

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT