problem to connect the application to the backend.
I use React Native with EXPO
The error occurs on a login screen when trying to validate a user on a DB in the sql-server
I believe the error is in this: async function sendForm () {
let response = await fetch ('http://myip:3000/login'
however, I don't know what could be wrong ... suddenly some Node module is missing.
1 - already redone the project
2 - deleted node_modules and yarn install to remake
3 - already test the Controller.js routes and they are working.
4 - images: https://ibb.co/B354qky https://ibb.co/ZRjKRnn https://ibb.co/pyDyM70
THIS IS THE ERROR:
[Unhandled promise rejection: SyntaxError: JSON Parse error: Unrecognized token '<']
at [native code]:null in parse
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guardat node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
Related
I am using react native and expo 4.4.4 and
"react-native-material-dropdown": "^0.11.1",
This library was picked from this Npm link and Github Link
Just copy pasted the example usage code you have given...
Its showing below error :
TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style')
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
I don't think react-native-material-dropdown is supported in Expo.
Use #react-native-community/picker instead.
This is my first post so apologies if the format is wrong or I'm missing info or something!
I'm unable to connect to an API running on localhost through an Android emulator, or on a physical iPhone using React Native.
I've tried to change the localhost in my fetch request so it now looks as follows:
https://MYIPADDRESS:44357/api/user/login
This is the error I get when trying to fetch the API
TypeError: Network request failed
- node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
- node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl
- node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error
- node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
- node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
- node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
- node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
- node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
- node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch
- node_modules\regenerator-runtime\runtime.js:293:29 in invoke
- node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch
- node_modules\regenerator-runtime\runtime.js:154:27 in invoke
- node_modules\regenerator-runtime\runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
- node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
- node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
* [native code]:null in flushedQueue
* [native code]:null in invokeCallbackAndReturnFlushedQueue
fetch('https://IPADDRESS:44357/api/user/login', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
user: this.state.username,
password: this.state.password,
})
})
I hope someone can help! :) Thanks in advance.
On Android Emulator, you should use http://127.0.0.1:44357.
On iOS Simulator, you should use http://10.0.2.2:44357.
On real devices, you should open 44357 port and use http://YOURIPADDRESS:44357.
I would like to use react-native-video in my app. However, what I've done doesn't work :
I created a new project using expo init Project1
Then I installed react-native-video : npm install --save react-native-video
I used then this : react-native link react-native-video
I only have for the moment App.js :
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Video from 'react-native-video';
export default function App() {
return (
<View style={styles.container}>
<Video source={{uri: './small.mp4'}} // Can be a URL or a local file.
ref={(ref) => {
this.player = ref
}} // Store reference
o.nBuffer={this.onBuffer} // Callback when remote video is buffering
onError={this.videoError} // Callback when video cannot be loaded
style={styles.backgroundVideo} />
</View>
);
}
Finally I use npm start
I have this error message :
undefined is not an object (evaluating 'RCTVideoInstance.Constants')
Stack trace:
node_modules/react-native-video/Video.js:265:11 in render
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:13042:21 in finishClassComponent
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:12970:4 in updateClassComponent
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:307:15 in invokeGuardedCallbackImpl
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:531:36 in invokeGuardedCallback
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:20488:8 in beginWork$$1
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:19370:24 in performUnitOfWork
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:19347:39 in workLoopSync
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:18997:22 in renderRoot
[native code]:null in renderRoot
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:18709:28 in runRootCallback
[native code]:null in runRootCallback
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:5642:32 in runWithPriority$argument_1
node_modules/scheduler/cjs/scheduler.development.js:643:23 in unstable_runWithPriority
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:5638:22 in flushSyncCallbackQueueImpl
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:5627:28 in flushSyncCallbackQueue
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:18556:30 in scheduleUpdateOnFiber
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:21822:15 in scheduleRootUpdate
node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:23042:20 in ReactNativeRenderer.render
node_modules/react-native/Libraries/ReactNative/renderApplication.js:52:52 in renderApplication
node_modules/react-native/Libraries/ReactNative/AppRegistry.js:116:10 in runnables.appKey.run
node_modules/react-native/Libraries/ReactNative/AppRegistry.js:197:26 in runApplication
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:436:47 in __callFunction
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:26 in __guard$argument_0
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:110:17 in __guard$argument_0
[native code]:null in callFunctionReturnFlushedQueue
...
I followed instructions from react-native-video : https://www.npmjs.com/package/react-native-video
Thanks a lot...
You have to eject your app from expo and use the bare workflow if you want to use "react-native-video".
Btw, you can use Expo Video instead of react-native-video : https://docs.expo.io/versions/latest/sdk/video/
You can add jcenter to android/build.gradle like this:
allprojects {
repositories {
.... # Keep the rest
jcenter() {
content {
includeModule("com.yqritc", "android-scalablevideoview")
}
}
}
}
This is worked for me hope it will also do your work
Warning: Failed prop type: Invalid prop Component supplied to PadView.
Hi, I am new to react-native, the red message just keep showing up, but everything looks fine, and the app rendered out correctly, but the red message just keeps showing up in the terminal, do you guys have any idea what doesn't that mean, thanks for the help.
Warning: Failed prop type: Invalid prop `Component` supplied to `PadView`.
- node_modules\react-native\Libraries\YellowBox\YellowBox.js:63:8 in console.error
- node_modules\expo\build\environment\muteWarnings.fx.js:27:24 in error
- node_modules\prop-types\checkPropTypes.js:20:20 in printWarning
- node_modules\prop-types\checkPropTypes.js:83:12 in checkPropTypes
- node_modules\react\cjs\react.development.js:1796:19 in validatePropTypes
- node_modules\react\cjs\react.development.js:1969:22 in createElementWithValidation
- node_modules\react-native-elements\src\list\ListItem.js:101:4 in ListItem
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:10696:27 in renderWithHooks
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:13481:6 in mountIndeterminateComponent
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:20459:25 in beginWork$$1
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:19370:24 in performUnitOfWork
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:19347:39 in workLoopSync
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18997:22 in renderRoot
* [native code]:null in renderRoot
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18709:28 in runRootCallback
* [native code]:null in runRootCallback
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:5642:32 in runWithPriority$argument_1
- node_modules\scheduler\cjs\scheduler.development.js:643:23 in unstable_runWithPriority
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:5638:22 in flushSyncCallbackQueueImpl
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:5627:28 in flushSyncCallbackQueue
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18556:30 in scheduleUpdateOnFiber
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:21822:15 in scheduleRootUpdate
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:23042:20 in ReactNativeRenderer.render
- node_modules\react-native\Libraries\ReactNative\renderApplication.js:52:52 in renderApplication
- node_modules\react-native\Libraries\ReactNative\AppRegistry.js:116:10 in runnables.appKey.run
- node_modules\react-native\Libraries\ReactNative\AppRegistry.js:197:26 in runApplication
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:436:47 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:111:26 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:384:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:110:17 in __guard$argument_0
* [native code]:null in callFunctionReturnFlushedQueue
Update react-native-elements. Issue was fixed in version 1.2.2 (was caused by some changes in propTypes treatment in React Native 0.61.1 I believe).
Version
"web3": "^1.2.1"
"react-native": "0.59.10"
From set-up tutorial and https://github.com/ethereum/web3.js/issues/1022, I was able to install web3 in react-native, however I got this error:
Error
Possible Unhandled Promise Rejection (id: 1):
TypeError: Cannot read property 'getReader' of undefined
TypeError: Cannot read property 'getReader' of undefined
at new exports.IncomingMessage (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:222317:34)
at module.exports.ClientRequest._connect (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:222201:22)
at blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:222115:14
at tryCallOne (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:45372:14)
at blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:45473:17
at blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46351:21
at _callTimer (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46240:9)
at _callImmediatesPass (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46276:9)
at Object.callImmediates (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46495:14)
at MessageQueue.__callImmediates (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:16572:16)`
The error occurs when I doing promise method like web3.eth.getTransactionCount or web3.eth.getBlock('latest').
I tried console.log(web3.version), no problem at all
I found out using web3#1.0.0-beta.34 is more stable for react-native, so the question mentioned problem does not appear anymore.