尝试显示警报时,UI冻结onChange事件

时间:2018-11-15 08:27:50

标签: javascript reactjs react-native

我正在使用react-native-datepicker Modal和onDateChange事件即时通讯来尝试显示变更。但是,当我这样做时,警报首先弹出,然后立即消失,然后冻结整个UI。我的代码如下。

<View style={{ flexDirection: 'row' }}>
            <DatePicker
                style={{ width:Dimensions.get('window').width/2 - 10}}
                date={this.state.date}
                mode="date"
                placeholder="select date"
                format="YYYY-MM-DD"
                minDate={minimumDate}
                maxDate={currentDate}
                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.dateChange(date)}}
            />
</View>

我的以下日期更改方法

 dateChange = (date)=>{
    alert("date is:",date)
 }

我在这里想念什么?

0 个答案:

没有答案