Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change "Pick a date" title in iOS? #389

Closed
VivekVithlani opened this issue Mar 18, 2020 · 7 comments
Closed

How to change "Pick a date" title in iOS? #389

VivekVithlani opened this issue Mar 18, 2020 · 7 comments
Labels

Comments

@VivekVithlani
Copy link

Ask your Question

How to change "Pick a date" title in iOS?

I try with below code
headerTextIOS={'Estimated Start Date'}

@mmazzarolo
Copy link
Owner

@VivekVithlani that should work, are you on the latest version of the picker?

@VivekVithlani
Copy link
Author

VivekVithlani commented Mar 20, 2020

@mmazzarolo Yes, I am using the latest version

Can you please put some example code?

@mmazzarolo
Copy link
Owner

import React, { useState } from "react";
import { Button, View } from "react-native";
import DateTimePickerModal from "react-native-modal-datetime-picker";

const Example = () => {
  const [isDatePickerVisible, setDatePickerVisibility] = useState(false);

  const showDatePicker = () => {
    setDatePickerVisibility(true);
  };

  const hideDatePicker = () => {
    setDatePickerVisibility(false);
  };

  const handleConfirm = date => {
    console.warn("A date has been picked: ", date);
    hideDatePicker();
  };

  return (
    <View>
      <Button title="Show Date Picker" onPress={showDatePicker} />
      <DateTimePickerModal
        headerTextIOS="Estimated Start Date"
        isVisible={isDatePickerVisible}
        mode="date"
        onConfirm={handleConfirm}
        onCancel={hideDatePicker}
      />
    </View>
  );
};

export default Example;

@mmazzarolo mmazzarolo changed the title headerTextIOS={'Estimated Start Date'} How to change "Pick a date" title in iOS? Mar 21, 2020
@doruxan
Copy link

doruxan commented Apr 12, 2020

I could not make it work either.

@achuinard
Copy link

This property is gone - what's the recommended way to set the header now?

@mmazzarolo
Copy link
Owner

@achuinard you should use the customHeaderIOS prop — we should have some issues mentioning it (e.g., #366)

@achuinard
Copy link

@mmazzarolo Thanks for the recommendation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants