-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.js
29 lines (23 loc) · 849 Bytes
/
common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {AppRegistry,DeviceEventEmitter,View,Platform} from 'react-native';
import'react';
import'react-native';
import React,{Component} from "react";
import {SmartAssets} from "react-native-smartassets";
SmartAssets.initSmartAssets();
DeviceEventEmitter.addListener('sm-bundle-changed',
(bundlePath)=>{
SmartAssets.setBundlePath(bundlePath);
});
import { NativeEventEmitter, NativeModules } from 'react-native';
if(Platform.OS != 'android') {//ios
const {UTBundleLoadEventEmitter} = NativeModules;
const bundleLoadEmitter = new NativeEventEmitter(UTBundleLoadEventEmitter);
const subscription = bundleLoadEmitter.addListener(
'DidLoadBundlePath',
(bundleInfo) => {
console.log('BundleLoad==' + bundleInfo.path);
SmartAssets.setBundlePath(bundleInfo.path);
}
);
}
require('react-native/Libraries/Core/checkNativeVersion');