-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
65 lines (56 loc) · 1.51 KB
/
index.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @format
*/
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import LargeComponentWrapper from './LargeComponentWrapper';
AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerComponent(
'LargeComponentWrapper',
() => LargeComponentWrapper,
);
function logChunks(message, maxChunkSize = 1000) {
const chunks = [];
let start = 0;
while (start < message.length) {
const end = start + maxChunkSize;
const chunk = message.slice(start, end);
chunks.push(chunk);
start = end;
}
for (const chunk of chunks) {
console.log(chunk);
}
}
if (__DEV__) {
const modules = require.getModules();
const moduleIds = Object.keys(modules);
const loadedModuleNames = moduleIds
.filter(moduleId => modules[moduleId].isInitialized)
.map(moduleId => modules[moduleId].verboseName);
const waitingModuleNames = moduleIds
.filter(moduleId => !modules[moduleId].isInitialized)
.map(moduleId => modules[moduleId].verboseName);
// make sure that the modules you expect to be waiting are actually waiting
console.log(
'RNExperiments | loaded:',
loadedModuleNames.length,
'RNExperiments | waiting:',
waitingModuleNames.length,
);
logChunks(
`RNExperiments | loadedModuleNames = ${JSON.stringify(
loadedModuleNames,
null,
2,
)};`,
);
logChunks(
`RNExperiments | waitingModuleNames = ${JSON.stringify(
waitingModuleNames,
null,
2,
)};`,
);
}