Socket
Socket
Sign inDemoInstall

react-native-uncontrolled-date-picker-ios

Package Overview
Dependencies
515
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-uncontrolled-date-picker-ios

Uncontrolled version of DatePickerIOS


Version published
Maintainers
1
Install size
171 kB
Created

Readme

Source

react-native-uncontrolled-date-picker-ios

Getting started

$ npm install react-native-uncontrolled-date-picker-ios --save

Mostly automatic installation

$ react-native link react-native-uncontrolled-date-picker-ios

Manual installation

iOS
  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-uncontrolled-date-picker-ios and add RNUncontrolledDatePickerIOS.xcodeproj
  3. In XCode, in the project navigator, select your project. Add RNUncontrolledDatePickerIOS.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Usage

Please check Example directory for an example project with the following implementation:

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
  AppRegistry,
  Button,
  StyleSheet,
  Text,
  View
} from 'react-native';
import UncontrolledDatePickerIOS from 'react-native-uncontrolled-date-picker-ios';

export default class Example extends Component {

  static propTypes = {
    date: PropTypes.instanceOf(Date)
  };

  static defaultProps = {
    initialDate: new Date(),
  };

  constructor(props) {
    super(props);
    this.state = {
      date: this.props.initialDate,
    };
  }

  onButtonPress = () => {
    this._datepicker.getDate((date) => {
      this.setState({ date });
    })
  }

  render() {
    return (
      <View style={styles.container}>
        <UncontrolledDatePickerIOS
          ref={(x) => { this._datepicker = x; }}
          date={this.props.initialDate}
          style={styles.datepicker}
        />
        <Button
          title="Get Datepicker Date"
          onPress={this.onButtonPress}
        />
        <Text>{this.state.date.toString()}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  datepicker: {
    width: '100%',
  },
});

AppRegistry.registerComponent('Example', () => Example);

Keywords

FAQs

Last updated on 02 Aug 2017

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc