React Native button for handling asynchronous operations

EF React Native Asynchronous Button

react-native button for handling asynchronous operations.

Usage

yarn add @ef-carbon/react-native-async-button
<View>
  <AsyncButton
    IdleComponent={<Text>Send</Text>}
    onPress={success}
  />
  <AsyncButton
    IdleComponent={<Text>Send + Reset</Text>}
    successTimeout={1000}
    SuccessComponent={SuccessComponent}
    onPress={success}
  />
  <AsyncButton
    IdleComponent={<Text>Send + No Reset</Text>}
    successTimeout={Infinity}
    SuccessComponent={SuccessComponent}
    onPress={success}
  />
  <AsyncButton
    IdleComponent={<Text>Error + Reset</Text>}
    failureTimeout={1000}
    FailureComponent={FailureComponent}
    onPress={error}
  />
  <AsyncButton
    IdleComponent={<Text>Error + No Reset</Text>}
    failureTimeout={Infinity}
    FailureComponent={FailureComponent}
    onPress={error}
  />
</View>

Read the [documentation][docs] for API guidance.

Development

The project attempts to make the workflow as frictionless as possible. Any suggestions to improve the work processes are
welcomed :metal:

Getting Started

Get up and running using [yarn][yarn]:

yarn install
yarn build

IDE

Install [Atom][atom] [IDE][atom-ide] with the [TypeScript][atom-ide-typescript] and [XTerm][atom-xterm] plugins

Hacking

Run yarn watch:test. Unit tests will re-run after any changes to the source code.

Testing

The unit tests use [Jest][jest].

Releases

Releases are performed automatically via [semantic-release][semantic-release]. When commits are merged to master
the [Conventional Commits][coventional-commits] are read and version number determined automatically.

Scripts

There are various scripts available that provide the workflow steps for the project:

Name Description
commit Starts the [commitizen][commitizen] CLI
distclean Returns the project to initial state
clean Returns the project to postinstall state
build Builds the project
build:ts Builds the TypeScript files into the JavaScript output
format Formats the project
lint Lints the project
lint:fix Fixes up simple linting rule violations automatically
lint:ci Validates the CI configuration file
lint:ts Performs linting of TypeScript files
lint:ts:fix Fixes up simple rule violations in TypeScript files
lint:format Checks the formatting of the TypeScript source code
lint:format:fix Automatically fixes up formatting violations
lint:commit Makes sure the commits follow the [conventional commits][coventional-commits] style
watch:ts Watches the TypeScript source files for changes
watch:test Re-runs unit tests on any file changes
test Tests the project
coverage Provides test coverage statistics for the project
ci Runs a set of commands that are needed to pass the CI workflow
fix Performs formatting and linting fixes
docs Builds API documentation
docs:open Opens up the built API documentation in the default browser

GitHub