# react-native-crash-trigger

> A simple module to trigger native Android or iOS crash

Latest version **1.1.0** (published 2018-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-crash-trigger
pnpm add react-native-crash-trigger
yarn add react-native-crash-trigger
bun add react-native-crash-trigger
```

## 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.1.0 |
| Published | 2018-10-06 |
| First published | 2018-10-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 171.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michael James Abadilla |
| Maintainers | mjmaix |
| Keywords | react-native, ios, android, native, module, crash, error |

## Links

- npm: https://www.npmjs.com/package/react-native-crash-trigger
- Repository: https://github.com/mjmaix/rreact-native-crash-trigger
- Homepage: https://github.com/mjmaix/react-native-crash-trigger#readme
- Issues: https://github.com/mjmaix/react-native-crash-trigger/issues
- npm.io page: https://npm.io/package/react-native-crash-trigger

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-10-06
- 1.0.0 — 2018-10-06

## README

# react-native-crash-trigger
A sample native module to integrate react-native application

# Install
```
npm i react-native-crash-trigger

react-native link react-native-crash-trigger
```

# Trigger
When Play button is pressed

# Sample

```
import Player from 'react-native-sample-module';

type Props = {};
export default class App extends Component<Props> {
  constructor(props) {
    super(props);

    this.state = {
      playbackState: 'NONE',
    }

    this.onPlaybackStateChanged = this.onPlaybackStateChanged.bind(this);
  }

  componentDidMount() {
    DeviceEventEmitter.addListener('onPlaybackStateChanged', this.onPlaybackStateChanged);
  }

  componentWillUnmount() {
    DeviceEventEmitter.removeListener('onPlaybackStateChanged', this.onPlaybackStateChanged);
  }

  onPlaybackStateChanged(event) {
    console.log("PlaybackState: " + event.state);
    this.setState({
      playbackState: event.state,
    })
  }

  onPlay() {
    Player.isPlaying((event) => {
      if (!event.playing) {
        Player.play("http://vprbbc.streamguys.net/vprbbc24-mobile.mp3");
      }
    })
  }

  onPause() {
    Player.isPlaying((event) => {
      if (event.playing) {
        Player.pause();
      }
    })
  }

  render() {
    return (
      <View style={styles.container}>
        <View style={{ flexDirection: 'row', alignSelf: 'stretch', justifyContent: 'space-around' }}>
          <Button
            title='Play'
            onPress={() => this.onPlay()}
            color='red'
          />
          <Button
            title='Pause'
            onPress={() => this.onPause()}
            color='red'
          />
        </View>
        <Text style={{ color: 'black', fontSize: 16 }}>{this.state.playbackState}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});
```


# Original code taken from
https://github.com/kyo504/react-native-sample-module

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