'React Native Expo Google Fonts: is not a system font and has not been loaded through Font.loadAsync

I'm using Expo Google Fonts and the useFonts() method to import the fonts for my app. However I get the following error but I thought I didn't need to use Font.loadasync with the Google Fonts (as per docs here). Can you let me know what I'm doing wrong here?

import React, { useState } from "react";
import { View, TouchableOpacity, Text, StyleSheet, Platform } from 'react-native'
import { useFonts, Kanit_400Regular, Kanit_500Medium, Kanit_700Bold } from '@expo-google-fonts/kanit';
import Colors from '../constants/Colors'

const Header = props => {

  useFonts({Kanit_400Regular, Kanit_500Medium, Kanit_700Bold})

  return (
    <View style={styles.headerContainer}>
      <View style={styles.logo}>
        <Text style={styles.headerText}>HEADER</Text>
      </View>
      <View>
        <Text style={{...styles.headerText, fontSize: 14 }}>LOGIN</Text>
      </View>
    </View>
  )
} 

const styles = StyleSheet.create({
  headerContainer: {
    padding: 15,
    paddingTop: Platform.OS === 'android' ? 40 : 15,
    backgroundColor: 'rgba(0,0,0,0.3)',
    justifyContent: 'space-between',
    height: Platform.OS === 'android' ? '12%' : '10%',
    borderBottomColor: Colors.borderGold,
    borderBottomWidth: 1,
    alignItems: 'center',
    flexDirection: 'row',
    fontSize: 16,
  },
  headerText: {
    fontSize: 16,
    color: Colors.primary,
    fontFamily: 'Kanit_500Medium',
  }
})

export default Header

enter image description here



Solution 1:[1]

//Write this code in service.ts

        async findOne(_id: number): Promise<any> {
          const new_req = await this.yourRepository.findOne({id: _id});
          return {
            StatusCode: HttpStatus.CREATED,
            message: "",
            result: new_req
          }

//and then write this code on your controller.ts

//For Get single request

  @Get('/:id')
  getSinglRequest(
    @Param('id') _id: number): Promise<any> {
    return this.yourService.findOne(_id);
  }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Khadim H.