Socket
Book a DemoInstallSign in
Socket

react-native-elements-prompt

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-elements-prompt

Prompt input component for react elements.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
14
180%
Maintainers
1
Weekly downloads
 
Created
Source

React native prompt.

npm version

Component opens full screen prompt modal with input field.

Based on react native elements buttons and react native modal.

Demo:

alt Demo

Installation:

NPM installation.

npm install --save react-native-elements-prompt

Props:

Required props:

  • visible: bool
  • onSubmit: func( inputValue )
  • onCancel: func()

Optional props:

  • Full list of props, see in example. // TODO: add list of optional props to Readme.

Usage:

How to use it in a react-native component:

import React from 'react';
import { View } from 'react-native';
import { Button } from 'react-native-elements';
import Prompt from 'react-native-elements-prompt';

export default class Component extends React.Component {

    state = {
      promptValue: '',
      showPrompt: false
    }
    
    _onPromptSubmit = ( inputValue ) => {
      this.setState({
        promptValue: inputValue,
        showPrompt: false
      })
    }
    _showPrompt = () => {
      this.setState({
        showPrompt: true
      })
    }
    _hidePrompt = () => {
      this.setState({
        showPrompt: false
      })
    }
    
  render() {
      return (
        <View>
          <Prompt
            visible={this.state.showPrompt}
            animationType='slide'
            title={{
              text:'Input something',
              style: {
                color:'grey'
              }
            }}
            input={{
              keyboardType:'numeric',
              placeholder:'some text',
              maxLength: 5,
              style: {
                fontSize: 48
              }
            }}
            submitButton={{
              text:'OK',
              color:'orange'
            }}
            cancelButton={{
              text:'Cancel'
              color:'red'
            }}
            onSubmit={ this._onPromptSubmit }
            onCancel={ this._hidePrompt }
          />
          <Button
            title='Show Prompt'
            onPress={ this._showPrompt }
          />
        </View>
      )
   }
}

Keywords

react

FAQs

Package last updated on 03 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.