Callback doesn't return anything [🐛]
See original GitHub issueDescription
I’ll have launchImageLibrary and launchCamera running and they open the photo picker or the camera, but once I select the photo and return to the application the callback doesn’t run.
code calling image picker
uploadPicture = () => {
console.log("uploadPicture running");
launchImageLibrary(
{
mediaType: 'photo',
includeBase64: true,
},
(response) => {
console.log(response, "image picker response");
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.errorCode) {
console.log('ImagePicker Error: ', response.errorMessage);
} else {
console.log("image Picker worked!")
}
}
);
}
Solution
What needs to be done to address this issue?
Additional Information
Additional Information Image Picker version: [“react-native-image-picker”: “^3.3.2”] React Native version: [“react-native”: “0.63.4”,] Platform: [Android]
Android Logs
2021-03-18 12:01:01.092 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: ViewPostIme pointer 0
2021-03-18 12:01:01.195 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: ViewPostIme pointer 1
2021-03-18 12:01:01.208 13495-13873/com.app.test I/ReactNativeJS: uploadPicture running
2021-03-18 12:01:01.262 13495-13495/com.app.test D/SensorManager: unregisterListener ::
2021-03-18 12:01:01.278 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
2021-03-18 12:01:03.233 13495-13873/com.app.test I/ReactNativeJNI: Memory warning (pressure level: TRIM_MEMORY_UI_HIDDEN) received by JS VM, ignoring because it's non-severe
2021-03-18 12:01:03.248 13495-13729/com.app.test D/OpenGLRenderer: eglDestroySurface = 0x7e4fb9eca0
2021-03-18 12:01:03.254 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x5 surface={valid=false 0} changed=true
2021-03-18 12:01:03.377 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=false 0} changed=false
2021-03-18 12:01:07.721 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=false 0} changed=false
2021-03-18 12:01:07.737 13495-13495/com.app.test D/SensorManager: registerListener :: 1, LSM6DSL Accelerometer, 66667, 0,
2021-03-18 12:01:07.759 13495-13495/com.app.test V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0
2021-03-18 12:01:07.759 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x7 surface={valid=true 542774386688} changed=true
2021-03-18 12:01:07.768 13495-13729/com.app.test D/OpenGLRenderer: eglCreateWindowSurface = 0x7e4fb9eca0
2021-03-18 12:01:07.809 13495-13495/com.app.test D/ViewRootImpl@b4ddbcb[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
2021-03-18 12:01:07.824 13495-13495/com.app.test V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@22c0f42 nm : com.app.test ic=null
2021-03-18 12:01:07.824 13495-13495/com.app.test I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:16 (3 by maintainers)
Top Results From Across the Web
Not able to return value even with callback function
Yes, you called foo correctly until you tried to return something. Returning isn't really a concept that applies to callback functions.
Read more >Callback doesn't return anything - Dash Python
A bool prop needs a bool value - if you need to control is_open as well as what content is displayed in output-state...
Read more >Callback Hell
Callback Hell. A guide to writing asynchronous JavaScript programs. What is "callback hell"? Asynchronous JavaScript, or JavaScript that uses callbacks, ...
Read more >How to Handle Async Callbacks in JavaScript...Without ...
I thought it was a great question, and it seems my brain doesn't work ... I want to return that, but how can...
Read more >callback-return - ESLint - Pluggable JavaScript Linter
To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey - having the same problem. Using m1 also
Just use react-native-crop-image-picker. Better solution anyways. https://github.com/ivpusic/react-native-image-crop-picker