1.0.1 • Published 2 years ago

flipper-plugin-arbitrary-buttons v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

flipper-plugin-arbitrary-buttons

A React Native plugin for Flipper that allows you to create buttons in Flipper that do arbitrary tasks in your app, all configured from within the app itself.

Table of Contents

Installation

Find and install the arbitrary-buttons plugin in Flipper

In your React Native app, make sure you have react-native-flipper installed

Usage

In your app, you can configure arbitrary buttons in Flipper like so:

if (__DEV__) {
  import('react-native-flipper').then(({addPlugin}) => {
    addPlugin({
      getId() {
        return 'arbitrary-buttons'
      },
      onConnect(connection) {
        connection.send('createButton', {
          buttonStyle: 'primary', // Can be any of the AntD button types, default is 'default'
          label: 'My custom debug task',
          methodName: 'customTask',
          usePayload: true, // Optional... when true, adds a text field where you can specify
                            // an arbitrary JSON payload to send to the client
          payloadPlaceholder: '{"custom": 1234}' // Optional... placeholder text for JSON payload field
        })

        connection.receive('customTask', (payload) => {
          // Do whatever you want!
        })
      },
      onDisconnect() { },
      runInBackground() {
        return false
      },
    })
  }
}

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.

1.0.1

2 years ago

1.0.0

2 years ago