I have a backend that can delivers audio or image files (audio/x-m4a or image/jpeg) so I have to show them on my react-native/expo app. So I have something like this:
In line 19 I'm getting a blob from the backend and on line 21 and getting its URI.
So when I call this component for two images and one audio I get this:
blob:7E5FD45B-B10F-447B-B37C-D429DBA72871?offset=0&size=96665
blob:0A1BD6A2-C5B0-40C4-BB77-9A5F4A0E52B7?offset=0&size=281234
blob:6E7EB36F-FBC0-4F34-ADAC-864F0F5B75DF?offset=0&size=816812
I'm not sure how URI works on mobile but these URI are pretty weird for me...
Them in line 25 I'm trying to load an expo's Audio.Sound but I get this error:
[Unhandled promise rejection: Error: The AVPlayerItem instance has failed with the error code -1002 and domain "NSURLErrorDomain".]
at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:104:50 in promiseMethodWrapper
at node_modules/expo-modules-core/build/NativeModulesProxy.native.js:27:27 in moduleName.methodInfo.name
at http://192.168.1.33:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:307121:50 in <unknown>
at node_modules/expo-av/build/Audio/Sound.js:136:34 in loadAsync
However I'm able to successfully show the image with line 38.
Any suggestion for the audio sound?
What you were expecting:
The custom form show
What happened instead:
f.pauseValidation is not a function is throw
Steps to reproduce:
Work according to the sample at https://marmelab.com/blog/2018/08/27/react-admin-tutorials-custom-forms-related-records.html
React-admin version: 3.2.2
Last version that did not exhibit the issue (if applicable):2.9.6
React version:16.9.0
Browser: Chrome
Stack trace (in case of a JS error):
above error occurred in the <ReactFinalForm> component:
in ReactFinalForm (created by FormWithRedirect)
in FormWithRedirect (created by SimpleForm)
in SimpleForm (at QuickCreateShippingAddressButton.js:94)
I'm building a React-Native app and whenever I run it on my Android emulator, I get this error:
Objects are not valid as a React child (found: object with keys
{$$typeof, type, key, ref, props, _owner, _store}). If you meant to
render a collection of children, use an array instead.
throwOnInvalidObjectType
D:\rn\manager\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:7436:6
Because this error means nothing to me, I decide to enable "Debug JS Remotely" in Chrome to see if I can get an error I understand. But with Debug Remotely enabled, the error goes away.
If I build the project and install the app on a real device, the errors come back.
But I feel like I'm stuck in a catch-22 because if I try to debug, I get no errors, and if I turn off debugging, I get errors.
Is there anyway to get around this?
Thanks!
The error mentions you use an object in your render() method where you shouldn't. Since you did not post any code, here is what you could do:
Keep removing elements from your render() method until you no longer get the error. Once it is gone, start placing code back until you hit the error again. The code causing the error will be or return an object, possibly a typo causing an object to be returned instead of a string for instance.
TL;DR: Stopped using firebase and used react-native-firebase instead
The problem for me wasn't the render method in any of my components or classes. I realized after trying the answer above, I basically removed all my files, and was left with one file. I changed the render method to display text inside one view, but I still got the error.
Then I started removing the modules I was importing inside that file one by one and found that it was the firebase module uninstalled firebase and installed react-native-firebase.
I was wondering if there is a way to log the current filename or directory in React Native. Similar to how NodeJS does it with __filename and __dirname.
No, it's not possible since all the source code gets bundled together into one big file, and then a source map is provided so that you can debug it in the original structure.
You can see that by calling this code snippet somewhere in your code:
console.log(new Error().stack);
In a regular javascript you would get the entire trace with files and line numbers, but in react-native you get somthing like:
Error
at Login (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:83009:9)
at instantiate (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:5712:18)
at new Login (eval at proxyClass (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:5730:16), <anonymous>:4:17)
at ReactCompositeComponentWrapper._constructComponentWithoutOwner (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:22051:19)
at ReactCompositeComponentWrapper._constructComponent (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:22033:13)
at ReactCompositeComponentWrapper.mountComponent (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:21952:15)
at Object.mountComponent (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:20425:29)
at ReactCompositeComponentWrapper.performInitialMount (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:22134:28)
at ReactCompositeComponentWrapper.mountComponent (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:22015:13)
at Object.mountComponent (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false:20425:29)"
which shows you the real files are gone.
Using casperJS script, after successful login into application, and clicking on a link, following error is thrown and web page comes as blank:
ERROR: TypeError: 'undefined' is not a function (evaluating
'g.getItem.bind(g)')
TRACE:
-> scripts/dojo/dojo/dojo.js: 20
ERROR: TypeError: 'undefined' is not a function (evaluating
'g.getItem.bind(g)')
The application is build on top of dojo.
You’ve written some code that tries to use Function.prototype.bind. Function.prototype.bind doesn’t exist in PhantomJS. You need to change your code to use dojo/_base/lang.hitch instead.