question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confirm and cancel buttons

See original GitHub issue

Issue

Hello, Thanks for the great library but I have a problem with the latest React Native version. The text of the confirm and cancel buttons is not displayed.

Expected Behavior

Text should be displayed in buttons.

Code

import React, { Component } from 'react'
import { View } from 'react-native'
import DatePicker from 'react-native-datepicker'

export default class MyDatePicker extends Component {
    constructor(props){
        super(props)
        this.state = {date:"2016-05-15"}
    }

    render(){
        return (
            <View style={{marginTop: 100}}>
            <DatePicker
                style={{width: 200}}
                date={this.state.date}
                mode="date"
                placeholder="select date"
                format="YYYY-MM-DD"
                minDate="2016-05-01"
                maxDate="2016-06-01"
                confirmBtnText="Confirm"
                cancelBtnText="Cancel"
                customStyles={{
                    dateIcon: {
                        position: 'absolute',
                        left: 0,
                        top: 4,
                        marginLeft: 0
                    },
                    dateInput: {
                        marginLeft: 36
                    }
                    // ... You can check the source to find the other keys.
                }}
                onDateChange={(date) => {this.setState({date: date})}}
            />
            </View>
        )
    }
}

Environment

  1. react-native -v: “0.54.2”
  2. node -v: v9.8.0
  3. npm -v: 5.6.0
  4. yarn --version: 1.5.1
  5. target platform: iOS
  6. operating system: OSX

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:15
  • Comments:7

github_iconTop GitHub Comments

87reactions
jeffbonassocommented, Mar 17, 2018

I figured out a workaround for this using the current build, although it should be updated in the library. Using Toggle Inspector in the debug tools you will see there is just no height for the text of the TouchableHighlight buttons. You can actually click on them. Because the library allows customStyles, I added the following to the CustomStyles property after the dateInput object when creating a <DatePicker> component…

,
btnTextConfirm: {
   height: 20
},
btnTextCancel: {
   height: 20
}
11reactions
ghostcommented, Apr 1, 2018

I figured out a workaround

@jeffbonasso you are a hero

Read more comments on GitHub >

github_iconTop Results From Across the Web

OK/Cancel on left/right? - User Experience Stack Exchange
So Cancel is always on the right of OK button. For MacOS. A button that initiates an action is furthest to the right....
Read more >
OK-Cancel or Cancel-OK? The Trouble With Buttons
OK-Cancel or Cancel-OK? The Trouble With Buttons. Summary: Should the OK button come before or after the Cancel button? Following platform ...
Read more >
Primary & Secondary Action Buttons | by Nick Babich | UX Planet
'OK'/'Cancel' button debate is very popular among designers: “Should the primary action button come before or after the secondary action button?
Read more >
Return confirm cancel button not working - Stack Overflow
the onlick confirm cancel button doesn't cancel the action but just keeps going. Somebody knows what's wrong with this return confirm ?
Read more >
“Ok-Key” and “Cancel-Key”, Which One Should Be Set Up on ...
“Ok-key” and “cancel-key”, which one should be set up on the left? It's an eternal war of button sort between UI designers preferring...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found