diff --git a/index.js b/index.js index 48cc5d62b..d6d409c26 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,13 @@ import 'react-native-gesture-handler'; // polyfills import 'react-native-get-random-values'; import { TextDecoder } from 'text-encoding'; +import Long from 'long'; +import protobuf from 'protobufjs'; global.TextDecoder = TextDecoder; +protobuf.util.Long = Long; +protobuf.configure(); + import {AppRegistry} from 'react-native'; import './shim.js' import App from './App.tsx'; diff --git a/models/BaseModel.ts b/models/BaseModel.ts index 27a632969..f2b691fa2 100644 --- a/models/BaseModel.ts +++ b/models/BaseModel.ts @@ -2,7 +2,15 @@ export default class BaseModel { constructor(data?: any) { Object.keys(data).forEach((field: any) => { - this[field] = data[field]; + // Handle Longs + if ( + data[field].high !== undefined && + data[field].low !== undefined + ) { + this[field] = data[field].toString(); + } else { + this[field] = data[field]; + } }); } }