@@ -10,6 +10,7 @@ import {
1010 Image ,
1111 View ,
1212 Text ,
13+ TextInput ,
1314 StyleSheet ,
1415 StatusBar ,
1516 ActivityIndicator ,
@@ -26,13 +27,30 @@ import { ListRow, Toast } from 'teaset';
2627import ToastView from '../equipment/ToastUtil' ;
2728import PopupDialog from '../modules/PopupDialog' ;
2829import 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- } ) ;
30+ let components = [ Text , TextInput ] ;
31+ const customProps = {
32+ style : {
33+ fontFamily : 'PingFangTC-Medium'
34+ } ,
35+ allowFontScaling : false
3536} ;
37+ components . map ( ( item , index ) => {
38+ const TextRender = item . prototype . render ;
39+ const initialDefaultProps = item . prototype . constructor . defaultProps ;
40+ item . prototype . constructor . defaultProps = {
41+ ...initialDefaultProps ,
42+ ...customProps
43+ } ;
44+ item . prototype . render = function render ( ) {
45+ let oldProps = this . props ;
46+ this . props = { ...this . props , ...customProps , style : [ this . props . style ] } ;
47+ try {
48+ return TextRender . apply ( this , arguments ) ;
49+ } finally {
50+ this . props = oldProps ;
51+ }
52+ } ;
53+ } ) ;
3654const customAnimationConfig = {
3755 duration : 400 ,
3856 create : {
0 commit comments