Created
          May 7, 2020 15:43 
        
      - 
      
- 
        Save ChronSyn/35df57eec90bc3f2e070dda0cae86730 to your computer and use it in GitHub Desktop. 
    CustomText component which can display expo google fonts. Direct replacement for Text from react-native
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import * as React from "react"; | |
| import { Text, TextProps } from "react-native"; | |
| import { useFonts } from '@use-expo/font'; | |
| import { | |
| Nunito_Regular400, | |
| Nunito_SemiBold600_Italic, | |
| } from '@expo-google-fonts/nunito'; | |
| const CustomText: React.FC<TextProps> = (props) => { | |
| const [fontsLoaded] = useFonts({ | |
| Nunito_Regular400, | |
| Nunito_SemiBold600_Italic, | |
| }); | |
| return fontsLoaded | |
| ? <Text style={[props.style, { fontFamily: "Nunito_Regular400" }]}>{props.children}</Text> | |
| : <></> | |
| } | |
| export default CustomText; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment