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.

Unhandled promise rejection `_reactNative.NativeModules.RNTimePickerAndroid.open`

See original GitHub issue

Bug

When trying to render the component, it simply does not show, raising the following exception a few seconds later:

[Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNTimePickerAndroid.open')]
- node_modules\@react-native-community\datetimepicker\src\timepicker.android.js:39:45 in open$
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:271:30 in invoke
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:135:28 in invoke
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:170:17 in <unknown>
- node_modules\promise\setimmediate\core.js:45:7 in tryCallTwo
- node_modules\promise\setimmediate\core.js:200:23 in doResolve
- node_modules\promise\setimmediate\core.js:66:12 in Promise
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:192:38 in enqueue
- node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:216:8 in async
* null:null in open
- node_modules\@react-native-community\datetimepicker\src\datetimepicker.android.js:35:39 in RNDateTimePicker
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:9473:27 in renderWithHooks
- ... 29 more stack frames from framework internals

Environment info

Running on expo 3.11.3.

Library version: any

Steps To Reproduce

  1. Place the component anywhere in the application.
  2. Run it.

Expected behavior:

  1. Date picker component shows normally.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
gabrieljablonskicommented, Feb 4, 2020

For some reason, RNTimePickerAndroid does not seem to be a thing when using expo. Not sure about when doing bare development.

Changing line 39 inside timepicker.android.js from

return NativeModules.RNTimePickerAndroid.open(options);

to

return NativeModules.TimePickerAndroid.open(options);

fixes the issue.

The complete solution should probably include a check to see if it’s running on expo.

2reactions
stoopkid1commented, Feb 16, 2020

@paulosborne on android, even after running the auto-linking i still had the same error (RN 0.6.1). i was able to get the library working by walking through the manual installation – and noticed my MainApplication.java file had not properly updated (the previous steps were correct though).

protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
     ...
     new RNDateTimePickerPackage()
  );
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled promise rejection: TypeError: _reactNative ...
I just used DateTimePicker from '@react-native ...
Read more >
null is not an object react native date picker - You.com
When I press "Open" to open the modal, I get a Render error that says TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNDatePicker....
Read more >
Possible Unhandled Promise Rejection (id: 0): | Mendix Forum
Hi,. It turned out that the NFCRead javascript action was only compatible with an older version of the React-Native-Nfc-Manager.
Read more >
React Native Auth0 Possible Unhandled Promise Rejection
In setting up samples, I've made some progress with the docs, but I've come into this error. Possible Unhandled Promise Rejection (id: 1): ......
Read more >
react-native-community/datetimepicker - npm
Given that the underlying component is a native view, not all of them are guaranteed to be supported, but testID and onLayout are...
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