Skip to content

Commit 0780eb0

Browse files
committed
将fontFamily应用到全局
1 parent 7d1d6da commit 0780eb0

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
4848
> [react-navigation-redux error][new-nav-redux]
4949
50-
5150
<img src="./assets/tab-navigator.png"/>
5251

5352
### 介绍 Redux 中间件(Middleware)

ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</AdditionalOptions>
8181
</TestAction>
8282
<LaunchAction
83-
buildConfiguration = "Release"
83+
buildConfiguration = "Debug"
8484
selectedDebuggerIdentifier = ""
8585
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
8686
launchStyle = "0"

ios/AwesomeProject/AppDelegate.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ @implementation AppDelegate
1717
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
1818
{
1919
NSURL *jsCodeLocation;
20-
for(NSString* family in [UIFont familyNames])
20+
/*for(NSString* family in [UIFont familyNames])
2121
{
2222
NSLog(@"%@", family);
2323
for(NSString* name in [UIFont fontNamesForFamilyName: family]){
2424
NSLog(@" %@", name);
2525
}
26-
}
26+
}*/
2727

2828
#ifdef DEBUG
2929
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { Provider } from 'react-redux';
3-
import { AppRegistry } from 'react-native';
3+
import { AppRegistry, Text } from 'react-native';
44
import AppWithNavigationState from './navigators';
55
import store, { middleware } from './redux/util';
66
import CodePush from 'react-native-code-push';

src/page/Root.js

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { bindActionCreators } from 'redux';
33
import { connect } from 'react-redux';
44
import SyanImagePicker from 'react-native-syan-image-picker';
55
import { NavigationActions } from 'react-navigation';
6+
67
import {
78
Alert,
89
AlertIOS,
@@ -25,6 +26,13 @@ import { ListRow, Toast } from 'teaset';
2526
import ToastView from '../equipment/ToastUtil';
2627
import PopupDialog from '../modules/PopupDialog';
2728
import MaskedView from '../modules/MaskedView';
29+
let oldRender = Text.prototype.render;
30+
Text.prototype.render = function(...args) {
31+
let origin = oldRender.call(this, ...args);
32+
return React.cloneElement(origin, {
33+
style: [origin.props.style, { fontFamily: 'PingFangTC-Medium' }]
34+
});
35+
};
2836
const customAnimationConfig = {
2937
duration: 400,
3038
create: {

0 commit comments

Comments
 (0)