Custom fonts working on IOs but not on Android react-native

Viewed 352

This is my react-native.config.js file:

 module.exports = {
  project: {
    ios: {},
    android: {}, // grouped into "project"
  },
  assets: ['./assets/fonts/'], // stays the same
};

I added some fonts to my assets/fonts folder and ran react-native link. after this I tested my application on IOs emulator and fonts have worked fine but on android it is not working.

Here is the whole component:

import React from 'react';
import {SafeAreaView, StyleSheet, Text} from 'react-native';

const styles = StyleSheet.create({
  textContainer: {
    marginTop: '30%',
    alignSelf: 'center',
  },
  text: {
    fontFamily: 'BodoniSvtyTwoITCTTBook',
    color: 'red',
    fontSize: 25,
  },
});

const App = () => {
  return (
    <SafeAreaView style={styles.textContainer}>
      <Text style={styles.text}>
        Welcome to Font-Play in react-native for android
      </Text>
    </SafeAreaView>
  );
};

export default App;

Location of the assets in android folder:

enter image description here

Any suggestions please?

1 Answers

add fonts in android/app/src/main/assets/fonts in the case of android and re-run the app.

Related