字体系列“gotham-medium”不是系统字体,还没有通过 font.loadasync 加载

时间:2021-03-22 08:58:58

标签: react-native react-native-android react-native-ios font-family

我正在使用 React Native 移动应用程序,当我将此项目执行到 Web 版本时,它工作正常,但是每当我尝试在 IOS 或 Andriod Emulator 中运行此项目时,它都会显示类似“font-family”Gotham- medium" 不是系统字体,还没有通过 font.loadasync 加载。

我也尝试过使用函数,但问题仍然存在。

import { AppLoading } from 'expo'; //Importing fonts but not working
import * as Font from 'expo-font';  //Importing fonts but not working
import React, {Component} from 'react';
import PropTypes from "prop-types";
import {StyleSheet, Text, View, TextInput, FlatList, Picker, ScrollView, TouchableHighlight} from 'react-native';
import {Image as ReactImage} from 'react-native';
import Svg, {Defs, Pattern} from 'react-native-svg';
import {Path as SvgPath} from 'react-native-svg';
import {Text as SvgText} from 'react-native-svg';
import {Image as SvgImage} from 'react-native-svg';

export default class Artboard1Copy2 extends Component {

  constructor(props) {
      super(props);
      this.state = {
          
      };
    
  }
  


  handlePress(target, owner) {
    if (this.props.onPress) {
        let name;
        let id;
        let index = -1;
        if (target.search("::") > -1) {
            const varCount = target.split("::").length;
            if (varCount === 2) {
                name = target.split("::")[0];
                id = target.split("::")[1];
            } else if (varCount === 3) {
                name = target.split("::")[0];
                index = parseInt(target.split("::")[1]);
                id = target.split("::")[2];
            }
        } else {
            name = target;
        }
        this.props.onPress({ type: 'button', name: name, index: index, id: id, owner: owner });
    }
  }

  handleChangeTextinput(name, value) {
      let id;
      let index = -1;
      if (name.search('::') > -1) {
          const varCount = name.split("::").length;
          if (varCount === 2) {
              name = name.split("::")[0];
              id = name.split("::")[1];
          } else if (varCount === 3) {
              name = name.split("::")[0];
              index = name.split("::")[1];
              id = name.split("::")[2];
          }
      } else {
          name = name;
      }
      let state = this.state;
      state[name.split('::').join('')] = value;
      this.setState(state, () => {
          if (this.props.onChange) {
              this.props.onChange({ type: 'textinput', name: name, value: value, index: index, id: id });
          }
      });
  }

  render() {
    
    return (
    <ScrollView data-layer="0104ead2-4e32-4611-8619-6cf3cc94b358" style={styles.artboard1Copy2}>
        <View data-layer="5163fcdd-d52a-422c-be67-d36d0085155c" style={styles.artboard1Copy2_layer1}>
            <View data-layer="4f371997-607d-4319-87d9-eb55672bb2f5" style={styles.artboard1Copy2_layer1_group801}>
                <ReactImage data-layer="17cb5172-d7e9-46d1-81f3-7a2bc0e121f8" source={require('./assets/group800.png')} style={styles.artboard1Copy2_layer1_group801_group800} />
            </View> //Assets images should be replaced or either removed otherwise it will create some glitch
            <ReactImage data-layer="bda2b401-a15f-4205-b622-27a62a91f752" source={require('./assets/rectangle635.png')} style={styles.artboard1Copy2_layer1_rectangle635} /> // Assets images should be replaced or either removed otherwise it will create some glitch
            <Svg data-layer="494047bf-69e5-4032-a8a0-b082346bcd17" style={styles.artboard1Copy2_layer1_path649} preserveAspectRatio="none" viewBox="4041.12255859375 194.33375549316406 1.5 1.5" fill="rgba(6, 6, 6, 1)"><SvgPath d="M 4041.87255859375 195.0837554931641 L 4041.87255859375 195.0837554931641 L 4041.87255859375 195.0837554931641 L 4041.87255859375 195.0837554931641 L 4041.87255859375 195.0837554931641 Z"  /></Svg>
            <Svg data-layer="bd8a156f-5c0f-420f-88b4-aff960422a80" style={styles.artboard1Copy2_layer1_path650} preserveAspectRatio="none" viewBox="4042.348876953125 194.33375549316406 1.5 1.5" fill="rgba(6, 6, 6, 1)"><SvgPath d="M 4043.098876953125 195.0837554931641 L 4043.098876953125 195.0837554931641 L 4043.098876953125 195.0837554931641 L 4043.098876953125 195.0837554931641 L 4043.098876953125 195.0837554931641 Z"  /></Svg>
            <View data-layer="c9f2c5b4-03dc-4240-bf89-741cff76ac3a" style={styles.artboard1Copy2_layer1_group802}>
                <Svg data-layer="4cad335d-2ca8-495b-8fe6-6a11744dbeba" style=[{][1]styles.artboard1Copy2_layer1_group802_line110} preserveAspectRatio="none" viewBox="0 -0.25 139.798828125 0.5" fill="transparent"><SvgPath d="M 0 0 L 139.7988128662109 0"  /></Svg>
                <Svg data-layer="fb4137eb-8b1c-4b23-90d1-bb0dae7d3473" style={styles.artboard1Copy2_layer1_group802_line111} preserveAspectRatio="none" viewBox="0 -0.25 142.4873046875 0.5" fill="transparent"><SvgPath d="M 0 0 L 142.4872436523438 0"  /></Svg>
                <Text data-layer="e27682e0-412b-46ed-8dc9-a654ea0fc8ca" style={styles.artboard1Copy2_layer1_group802_or}>or</Text>
            </View>
            <Text data-layer="b53388fe-7577-4486-935b-d2e835ac5317" style={styles.artboard1Copy2_layer1_marketplace}>Marketplace</Text> 
            <ReactImage data-layer="21f23fbd-0c20-4054-a64a-dc2367155b4f" source={require('./assets/rectangle636.png')} style={styles.artboard1Copy2_layer1_rectangle636} />
            <Text data-layer="5b24a6e6-dc2a-4452-a596-a675b37338fc" style={styles.artboard1Copy2_layer1_signUp}>Sign Up</Text> // Assets images should be replaced or either removed otherwise it will create some glitch
            <View data-layer="1bf1b809-d4ff-47c7-a140-6783329a172d" style={styles.artboard1Copy2_layer1_rectangle637}></View>
            <View data-layer="47d4fee5-bcce-4ee3-a539-7aeba790cdc1" style={styles.artboard1Copy2_layer1_rectangle638}></View>
            <View data-layer="8b7c82a6-30cf-446c-b9ab-131a7cffa270" style={styles.artboard1Copy2_layer1_rectangle639}></View>
            <View data-layer="4bd2798b-baee-44fb-84ff-914e7ab57b2a" style={styles.artboard1Copy2_layer1_rectangle640}></View>
            <View data-layer="509e3cc9-9233-4369-bd59-6ac8684deb14" style={styles.artboard1Copy2_layer1_rectangle641}></View>
            <View data-layer="4bc54dff-10a5-47c7-bad4-e2415a1fa09b" style={styles.artboard1Copy2_layer1_group803}>
                <Svg data-layer="abbdda64-39f4-44f1-983b-fd74d78faa75" style={styles.artboard1Copy2_layer1_group803_path651} preserveAspectRatio="none" viewBox="4077.419921875 415.7309875488281 15.030029296875 27.555023193359375" fill="rgba(255, 255, 255, 1)"><SvgPath d="M 4086.951904296875 442.5360107421875 L 4086.951904296875 430.6510009765625 L 4090.94091796875 430.6510009765625 L 4091.5390625 426.0190124511719 L 4086.951904296875 426.0190124511719 L 4086.951904296875 423.06201171875 C 4086.951904296875 421.7210083007813 4087.323974609375 420.8070068359375 4089.248046875 420.8070068359375 L 4091.699951171875 420.8059997558594 L 4091.699951171875 416.6629943847656 C 4091.27587890625 416.6069946289063 4089.820068359375 416.4809875488281 4088.1259765625 416.4809875488281 C 4084.590087890625 416.4809875488281 4082.1689453125 418.6390075683594 4082.1689453125 422.60400390625 L 4082.1689453125 426.0190124511719 L 4078.169921875 426.0190124511719 L 4078.169921875 430.6510009765625 L 4082.1689453125 430.6510009765625 L 4082.1689453125 442.5360107421875 L 4086.951904296875 442.5360107421875 L 4086.951904296875 442.5360107421875 Z"  /></Svg>
            </View>
            <ReactImage data-layer="636ca82e-8c84-4091-9a77-f52c095e0991" source={require('./assets/rectangle642.png')} style={styles.artboard1Copy2_layer1_rectangle642} />
            <Text data-layer="3344011c-f087-4a3b-bea6-8846f2edf9de" style={styles.artboard1Copy2_layer1_signUpWithFacebook}>Sign Up with Facebook</Text>
            <Text data-layer="9794a6df-31d7-439e-b63c-726a39187c57" style={styles.artboard1Copy2_layer1_signUpWithGoogle}>Sign Up with Google</Text>
            <Text data-layer="896da97c-400c-4101-be23-14fbf15155c3" style={styles.artboard1Copy2_layer1_fullName}>Full Name</Text>
            <Text data-layer="837aebbc-dfcf-4a55-8639-c682c6a0b8b9" style={styles.artboard1Copy2_layer1_eMail}>E-mail</Text>
            <Text data-layer="956c9d89-c579-4585-b652-59c0c7cfedf9" style={styles.artboard1Copy2_layer1_password}>Password</Text>
            <Text data-layer="d6b7b9c5-ce34-4a9d-82b1-1f5ef6994b10" style={styles.artboard1Copy2_layer1_bySigningUpYouAcceptTheTermsOfServiceAndprivacyPolicy}>By signing up you accept the Terms of Service and
Privacy Policy</Text>
            <Text data-layer="61d3b860-b090-4853-b147-21ba0da8b045" style={styles.artboard1Copy2_layer1_alreadyHaveAnAccountLogIn}>Already have an account? Log in</Text>
        </View>
    </ScrollView>
    );
  }
}

Artboard1Copy2.propTypes = {

}

Artboard1Copy2.defaultProps = {

}
 Assets images should be replaced or either removed otherwise it will create some glitch

0 个答案:

没有答案