react-native-single-prompt

2.0.1 • Public • Published

React-native-single-prompt

badge

Prompt component with single input field

import Prompt from 'react-native-single-prompt';

image image

Simulator Screen Recording - iPhone 13 - 2022-06-11 at 08 42 46 Simulator Screen Recording - iPhone 13 - 2022-06-11 at 11 32 20

Usage

  1. Installation
yarn add react-native-single-prompt

or

npm i react-native-single-prompt
  1. Code sample
    I highely advise controlling prompt with Modal from core react-native API
import Prompt from 'react-native-single-prompt';
import {Modal} from 'react-native';

const App = () => {
  const [isPromptActive, setIsPromptActive] = useState(false);

  return (
    <SafeAreaView style={{flex: 1}}>
      <Modal transparent={true} visible={isPromptActive} animationType="fade">
        <Prompt
          exit={() => setIsPromptActive(false)}
          callback={value => Alert.alert('Prompt confirmed', value)}
          name="iOS"
        />
      </Modal>
      <Button title="Activate prompt" onPress={() => setIsPromptActive(true)} />
    </SafeAreaView>
  );
};
  1. Optional props
    backgroundOpacity={value: number}, value in range: <0;1>, default = 0.5

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    2
    • latest

Version History

Package Sidebar

Install

npm i react-native-single-prompt

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

24.1 kB

Total Files

17

Last publish

Collaborators

  • kamildike