xgfe / react-native-datepicker

react native datePicker component for both Android and IOS, useing DatePikcerAndroid, TimePickerAndroid and DatePickerIOS
MIT License
2.12k stars 726 forks source link

Error after updating react-native and expo #348

Open goskan93 opened 5 years ago

goskan93 commented 5 years ago

Issue

I updated expo sdk and react-native and now when I click on DatePicker element I recive an Exception

Exception in HostFunction: Malformed calls from JS: field sizes are different.

Screenshot_20190703-165714

Expected Behavior

Should work like it used too with old version.

Code

              <DatePicker
                locale={'pt'}
                style={{width: SCREEN_WIDTH*0.65, borderWidth:0, marginBottom:20, marginTop:10, borderColor: 'transparent'}}
                date={this.state.DataValidade ? this.state.DataValidade : ""}
                mode="date"
                placeholder="Selecione uma data"
                format="DD/MM/YYYY"
                minDate={new Date()}
                maxDate="2040-01-01"
                confirmBtnText="Confirmar"
                cancelBtnText="Cancelar"
                onDateChange={(date) => this.onChangeText(date, 'DataValidade')}
              />

Environment

  1. react-native -v: 0.57.1 => 0.59.8
  2. target platform: Android
  3. expo: 32.0.0 => 33.0.0
goskan93 commented 5 years ago

I found it, it was enough to changemaxDate="2040-01-01" to maxDate={new Date(2040, 0, 1)}

matteocollina commented 4 years ago

If you don't want to set maxDate and minDate, set those fields to null