# react-native-slider-alert

> A simple React Native component to show a top message.

Latest version **1.0.2** (published 2018-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-slider-alert
pnpm add react-native-slider-alert
yarn add react-native-slider-alert
bun add react-native-slider-alert
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-09-14 |
| First published | 2018-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 431.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Antonio Moreno Valls |
| Maintainers | apsl |
| Keywords | react, react-native, alert, slider-alert, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-slider-alert
- Repository: https://github.com/InterfaceKit/react-native-slider-alert
- Homepage: https://github.com/InterfaceKit/react-native-slider-alert#readme
- Issues: https://github.com/InterfaceKit/react-native-slider-alert/issues
- npm.io page: https://npm.io/package/react-native-slider-alert

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-09-14
- 1.0.1 — 2018-09-14
- 1.0.0 — 2018-08-31

## README

# react-native-slider-alert

<p>
<img src="https://img.shields.io/npm/dm/react-native-slider-alert.svg" />
<img src="https://img.shields.io/npm/dt/react-native-slider-alert.svg" />
</p>

A React Native component to show a top message, useful for ScrollView or View.

<p align="center">
<img src="./simulator.png" height="40%" width="40%">
</p>

## Getting started

```sh
$ yarn add react-native-slider-alert
```

## Usage

To show the message and the slider alert, you should place the `SliderAlert` element at the top of the `render` method and jsx.
Then, call `showAlert` function to display it, as the example below. This function accepts a required message (`string` type) and a optional function that will be executed when animation ends.

```js
/* @flow */

import React from 'react';
import { TouchableOpacity, StyleSheet, Text, View, Image } from 'react-native';
import SliderAlert from './lib/SliderAlert';

type Props = {};

export default class App extends React.PureComponent<Props> {
  _alert: SliderAlert;

  onPressButton = () => {
    this._alert.showAlert('Welcome back to React Native!', () =>
      console.log('onAnimationEnd');
    );
  };

  render() {
    return (
      <View style={styles.top}>
        <SliderAlert
          ref={(ref: any) => {
            this._alert = ref;
          }}
          startValue={70}
          value={0}
          containerStyle={{
            backgroundColor: '#F4D35E'
          }}
          titleStyle={{
            fontSize: 18,
            fontFamily: 'Avenir Next'
          }}
        />
        <View style={styles.container}>
          <Text style={styles.welcome}>Welcome to React Native!</Text>
          <TouchableOpacity style={styles.button} onPress={this.onPressButton}>
            <Text style={styles.title}>Show message</Text>
          </TouchableOpacity>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  top: {
    flex: 1
  },
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF'
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10
  },
  button: {
    backgroundColor: '#DA4167'
  },
  title: {
    margin: 20,
    color: '#FFFFFF'
  }
});
```

## API

|   Props    |        Type        |                     Description                      | Required |
| :--------: | :----------------: | :--------------------------------------------------: | :------: |
| startValue |       number       | The initial value at which the animation will expand |    ✓     |
|   value    |       number       |     The final value which will end the animation     |    ✓     |
| titleStyle |       Object       |                 Styles of the title                  |    ✗     |
|   delay    |       number       |       Delay value of the predefined animation        |    ✗     |
|  duration  |       number       |      Duration value of the predefined animation      |    ✗     |
|  children  | React.ReactElement |   Custom children prop. Accepts any React element    |    ✗     |

## License

MIT License

Copyright (c) 2018 [InterfaceKit](https://github.com/InterfaceKit)

## Author

Antonio Moreno Valls `<amoreno at apsl.net>`

Built with 💛 by [APSL](https://github.com/apsl).

---
_Source: https://npm.io/package/react-native-slider-alert · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
