react-native-actually-usable-prompt

0.0.11 • Public • Published

react-native-actually-usable-prompt

Installation

yarn add react-native-actually-usable-prompt

Definition

Available here.

Usage

import Prompt from 'react-native-actually-usable-prompt';
 
<Prompt ref={ref => (this.p = ref)} />;
 
// then run
this.p.prompt('Trololo?', answer => console.log(answer), {
  // optional, see types for a list of available options
  subtitle: 'BOPadududu-dah-da-du-daaaah!',
 
  // typical TextInput props ..
  autoFocus: true,
  clearButtonMode: 'always',
  placeholder: 'Type here ..',
  underlineColorAndroid: 'transparent',
  defaultValue: 'Ya ya yaaaah'
 
  // you can also pass these to <Prompt /> directly through a global config prop
});
 
// to show confirmation instead of input
this.p.confirm('Trololo!?', yes => console.log(yes), {
  // optional, see types for a list of available options
  subtitle: 'BOPadududu-dah-da-du-daaaah!'
});
 
// to show an alert
this.p.alert('Trololo!', {
  // optional, see types for a list of available options
  subtitle: 'BOPadududu-dah-da-du-daaaah!'
});
 
// to show a select dialog
this.p.select(
  'Trololo?',
  ['Ya ya yaaaah', 'Huh?'],
  (index, value) => console.log(index, value),
  {
    // optional, see types for a list of available options
    subtitle: 'BOPadududu-dah-da-du-daaaah!'
  }
);
 
// <Prompt /> should be placed at the end of your UI to have a higher zIndex value
// or manipulate directly through overlayStyle prop
 
// e.g.
 
<Container>
  <UI />
  <Prompt />
</Container>;

Example

Available here.

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-actually-usable-prompt

Weekly Downloads

10

Version

0.0.11

License

none

Unpacked Size

13.7 kB

Total Files

6

Last publish

Collaborators

  • sonaye