Skip to content

Commit 6ec8dca

Browse files
committed
update to use RN platform
1 parent c1affb9 commit 6ec8dca

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

templates/react-native/package.json.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@
3434
},
3535
"dependencies": {
3636
"expo-file-system": "16.0.8",
37-
"expo-device": "5.9.3"
37+
"react-native": "^0.73.6"
3838
},
3939
"peerDependencies": {
40-
"expo": "*"
40+
"expo": "*",
41+
"react-native": "*"
4142
}
4243
}

templates/react-native/src/client.ts.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Models } from './models';
22
import { Service } from './service';
3-
import * as Device from 'expo-device'
3+
import { Platform } from 'react-native';
44

55
type Payload = {
66
[key: string]: any;
@@ -211,7 +211,7 @@ class Client {
211211
this.realtime.url = url;
212212
this.realtime.socket = new WebSocket(url, undefined, {
213213
headers: {
214-
Origin: `{{ spec.title | caseLower }}-${Device.osName}://${this.config.platform}`
214+
Origin: `{{ spec.title | caseLower }}-${Platform.OS}://${this.config.platform}`
215215
}
216216
});
217217
this.realtime.socket.addEventListener('message', this.realtime.onMessage);
@@ -330,7 +330,7 @@ class Client {
330330

331331

332332
headers = Object.assign({}, this.headers, headers);
333-
headers.Origin = `{{ spec.title | caseLower }}-${Device.osName}://${this.config.platform}`
333+
headers.Origin = `{{ spec.title | caseLower }}-${Platform.OS}://${this.config.platform}`
334334

335335
let options: RequestInit = {
336336
method,

templates/react-native/src/services/template.ts.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { {{ spec.title | caseUcfirst}}Exception, Client } from '../client';
33
import type { Models } from '../models';
44
import type { UploadProgress, Payload } from '../client';
55
import * as FileSystem from 'expo-file-system';
6-
import * as Device from 'expo-device';
6+
import { Platform } from 'react-native';
77

88
{% set added = [] %}
99
{% for method in service.methods %}

0 commit comments

Comments
 (0)