-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
39 lines (35 loc) · 1.01 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
import 'react-native-gesture-handler';
import React from 'react';
import Home from '@registry/home';
import Test from '@registry/test';
import { ComponentName } from '@registry/app';
import { AppRegistry, LogBox, Text } from 'react-native';
import { name as appName } from './package.json';
const ComponentMap = {
[appName]: Home,
[ComponentName.Home]: Home,
[ComponentName.Test]: Test,
};
Object.keys(ComponentMap).forEach(name => {
AppRegistry.registerComponent(name, () => ComponentMap[name]);
});
// 忽略警告
LogBox.ignoreAllLogs();
// 字体默认样式
(function settingFont(Text) {
let _render = Text.render;
Text.render = function (...args) {
const originText = _render.apply(this, args);
const { style, numberOfLines, children } = originText.props;
return React.cloneElement(originText, {
allowFontScaling: false, // 防止字体随系统的大小而改变
style: [
{
fontSize: 14,
color: '#000000',
},
style,
],
});
};
})(Text);