hafas-client: "PARSE" Error when using with react-native
Hi i get following error when i use it with react native. This is only with client.journys(…). client.locations(…) works fine.
This error is only when i am not in dubugging mode. When i am in debugging mode it works. This is my code:
const createClient = require('hafas-client')
const dbProfile = require('hafas-client/p/db')
const client = createClient(dbProfile)
const münchenHbf = {
type: 'station',
id: '008000261',
name: 'München Hbf',
locations: {
type: 'location',
latitude:48.140364,
longitude:11.558735
}
}
const münchenPassing = {
type: 'station',
id: '008004158',
name: 'München-Pasing',
locations: {
type: 'location',
latitude:48.150036,
longitude:11.461624
}
}
const opt = {
//var date2 = new Date('2018-12-17T03:24:00');
when: new Date('2018-05-29T06:40:00'),
whenRepresents: 'departure', // use 'arrival' for journeys arriving before `when`
//earlierThan: null, // ref to get journeys earlier than the last query
//laterThan: null, // ref to get journeys later than the last query
results: 5, // how many journeys?
via: null, // let journeys pass this station
passedStations: false, // return stations on the way?
transfers: 5, // maximum of 5 transfers
transferTime: 0, // minimum time for a single transfer in minutes
accessibility: 'none', // 'none', 'partial' or 'complete'
bike: false, // only bike-friendly journeys
products: {
// these entries may vary from profile to profile
suburban: true,
subway: true,
tram: true,
bus: true,
ferry: true,
//express: true,
regional: true
},
tickets: false, // return tickets? only available with some profiles
polylines: false // return a shape for each leg?
}
client.journeys(münchenPassing, münchenHbf, opt)
.then((arr)=>{
console.log('===============arr=====================');
console.log(arr);
console.log('====================================');
})
.catch(console.error)
}
PARSE
request
request.js:54:13
more
index.js:134:18
journeys
index.js:168:14
componentDidMount
App.js:130:20
proxiedComponentDidMount
createPrototypeProxy.js:61:45
commitLifeCycles
ReactNativeRenderer-dev.js:10627:12
commitAllLifeCycles
ReactNativeRenderer-dev.js:12512:10
invokeGuardedCallback
ReactNativeRenderer-dev.js:39:15
invokeGuardedCallback
ReactNativeRenderer-dev.js:221:34
commitRoot
ReactNativeRenderer-dev.js:12677:10
completeRoot
ReactNativeRenderer-dev.js:13685:46
performWorkOnRoot
ReactNativeRenderer-dev.js:13635:23
performWork
ReactNativeRenderer-dev.js:13545:26
performSyncWork
ReactNativeRenderer-dev.js:13506:16
requestWork
ReactNativeRenderer-dev.js:13392:6
scheduleWorkImpl
ReactNativeRenderer-dev.js:13259:24
scheduleWork
ReactNativeRenderer-dev.js:13207:28
scheduleRootUpdate
ReactNativeRenderer-dev.js:13930:17
_updateContainerAtExpirationTime
ReactNativeRenderer-dev.js:13966:6
updateContainer
ReactNativeRenderer-dev.js:13991:8
render
ReactNativeRenderer-dev.js:14726:35
renderApplication
renderApplication.js:49:21
run
AppRegistry.js:102:10
runApplication
AppRegistry.js:194:26
__callFunction
MessageQueue.js:351:47
<unknown>
MessageQueue.js:116:26
__guardSafe
MessageQueue.js:314:6
callFunctionReturnFlushedQueue
MessageQueue.js:115:17
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 36 (15 by maintainers)
Hi @soldatos,
please have a look at FahrplanApp for an example of hafas-client with react native.
I’ve had a look into this once more.
I successfully ran
hafas-client@3.0.0-alpha.9– installed vianpm i hafas-client@next– on the device and managed to fetch departures. I addednode-libs-react-nativeto the config and used the global shims. Will add a notice about this to the readme.I assume all other errors are related to specifics of your local setup. I’m willing to help debug this, but only with comprehensive info.