Giter VIP home page Giter VIP logo

react-native-datalist-input's Introduction

React Native Datalist Input

This package provides React Native TextInput component that contains a drop down menu to pick a possible option based on the current input.

Installation

Using NPM:

npm i @avul/react-native-datalist-input react-native-get-random-values

Using Yarn:

yarn add @avul/react-native-datalist-input react-native-get-random-values

Demo

Android.Emulator.-.Galaxy_Nexus_API_31_5556.2022-11-16.20-43-54.mp4

Usage

import React, {useState} from 'react';
import {StyleSheet, View, Text} from 'react-native';
import DatalistInput from '@avul/react-native-datalist-input';

const App = () => {
  const [value, setValue] = useState('');

  return (
    <View style={styles.screen}>
      <Text style={styles.titleStyle}>DEMO</Text>
      <DatalistInput
        containerStyle={styles.containerStyle}
        value={value}
        onChangeText={text => setValue(text)}
        data={['Javascript', 'JAVA', 'Python', 'C#', 'C++', 'R', 'PHP', 'Go']}
        style={styles.inputStyle}
        placeholder="Enter a language"
        placeholderTextColor="#cdcdcd"
      />
    </View>
  );
};

const styles = StyleSheet.create({
  screen: {
    flex: 1,
    alignItems: 'center',
    backgroundColor: '#2c2c2c',
    justifyContent: 'center',
  },
  containerStyle: {
    width: '80%',
  },
  inputStyle: {
    color: '#cdcdcd',
  },
  titleStyle: {
    color: '#cdcdcd',
    fontSize: 18,
    marginBottom: 15,
  },
});

export default App;

Available Props

Prop Type Description
value String Required for controlled components. Value of the text input.
onChangeText Function Required for controlled components. Callback that is called when the textinput's text changes.
data Array Required for controlled components. Array of values to be listed. Please see example.
containerStyle Array or Object Optional. Styling of view element.
style Array or Object Optional. Styling of textinput element.
menuStyle Array or Object Optional. Styling of view element that contains datalist
menuItemStyle Array or Object Optional. Styling of text element that belongs to datalist
... TextInput props Optional. Please see documentation for more details.

react-native-datalist-input's People

Contributors

acelyavul avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.