1.0.1 • Published 3 years ago

rnative-picker v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

React native time picker

Installation

npm i rnative-picker

Alt Text

#Small Example

import React, {useState} from 'react';
import {SafeAreaView,Button} from 'react-native';
import Picker from 'rnative-picker';


export default App = () => {

  const [showPicker, setShowPicker] = useState(false);

  return (
    <SafeAreaView style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <Button
          title="Show the Picker"
          color="#841584"
          onPress={()=>setShowPicker(true)}
        />
        
      <Picker 
         show={showPicker}                 
         onClose={(res)=>{                     // called on close the picker
             setShowPicker(false);             // Set showPicker to false (mandatory)
             console.log(res)}
             }  

         animationType="fade"                    
        #  cancelButtonStyle={{borderRadius : 2}}   // optional props
        #  cancelButtonTextStyle={{color : 'red'}}  
        #  pickerStyle={{height : '70%'}}      
        #  submitButtonStyle={{backgroundColor : 'red'}}
        # submitButtonTextStyle={{fontSize : 20}}      
       />

    </SafeAreaView>
  );
};
PropsTypes
showstate (if true show the picker otherwise not)
onClosewhen picker closed, receives a callback with one parameter containing result. (mandatory : change state value to false here to close the picker)
animationTypevalue may be "fade" , "slide" ,"none"
cancelButtonStyle (optional)any valid style apply for view
cancelButtonTextStyle (optional)any valid style apply for view
pickerStyle (optional)any valid style apply on view
submitButtonStyle (optional)any valid style apply on view
submitButtonTextStyle (optional)any valid style apply on view