Skip to content

A Flipper plugin for React Native for making arbitrary Flipper buttons to do arbitrary things.

Notifications You must be signed in to change notification settings

dougkeen/flipper-plugin-arbitrary-buttons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A Flipper plugin for React Native for making arbitrary Flipper buttons to do arbitrary things.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published