简体   繁体   English

应用程序在调试模式下崩溃以响应本机日期时间选择器

[英]App getting crashed in debug mode for react native date time picker

I installed @react-native-community/datetimepicker after which my app is crashing on launch even on debug mode.我安装了@react-native-community/datetimepicker,之后我的应用程序在启动时崩溃,即使在调试模式下也是如此。 I uninstalled and re-installed the library though still getting the same.我卸载并重新安装了该库,但仍然相同。 Not able to figure out the error.无法找出错误。

Do the following:请执行下列操作:

Open Android Studio, and check for debug logs in Logcat (make sure you select your debuggable process)打开 Android Studio,并在 Logcat 中检查调试日志(确保 select 是您的可调试进程)

If you do not find any error there, do the following:如果在那里没有发现任何错误,请执行以下操作:

1. Run fresh: react-native run-android 1.跑鲜: react-native run-android

2. Reset cache: react-native start --reset-cache 2.重置缓存: react-native start --reset-cache

  1. Clean Android: cd android —> ./gradlew clean清洁 Android: cd android —> ./gradlew clean

use native base datepicker使用本机基础日期选择器

install nativebase安装nativebase

npm i nativebase --save

then import datePicker from nativebase然后从 nativebase 导入 datePicker

import {DatePicker} from 'native-base';
      <DatePicker
            defaultDate={new Date(2018, 4, 4)}
            minimumDate={new Date(2018, 1, 1)}
            maximumDate={new Date(2018, 12, 31)}
            locale={"en"}
            timeZoneOffsetInMinutes={undefined}
            modalTransparent={false}
            animationType={"fade"}
            androidMode={"default"}
            placeHolderText="Select date"
            textStyle={{ color: "green" }}
            placeHolderTextStyle={{ color: "#d3d3d3" }}
            onDateChange={this.setDate}
            disabled={false}
            />

for complete guide this link will help you https://docs.nativebase.io/Components.html#date-picker-def-headref如需完整指南,此链接将为您提供帮助https://docs.nativebase.io/Components.html#date-picker-def-headref

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM