Ошибка загрузки родной базы шрифта

Предполагая, что вы хотите изображение в оттенках серого:

im = Image.new('L', (width, height))
im.putdata(an_array.flatten().tolist())
im.save("image.tiff")
23
задан Igor Martins 15 November 2017 в 13:55
поделиться

3 ответа

вам нужно дождаться загрузки шрифтов. Вы можете сделать что-то вроде этого

import React from "react";
import { StatusBar } from "react-native";
import { Container, Button, text, ListItem, Text } from "native-base";
import Expo from "expo";

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = { loading: true };
  }

  async componentWillMount() {
    await Expo.Font.loadAsync({
      Roboto: require("native-base/Fonts/Roboto.ttf"),
      Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
      Ionicons: require("@expo/vector-icons/fonts/Ionicons.ttf"),
    });
    this.setState({ loading: false });
  }

  render() {
    if (this.state.loading) {
      return <Expo.AppLoading />;
    }
    return (
      <Container>
        <StatusBar hidden={true} />

        <Button>
          <Text>Button</Text>
        </Button>

        <ListItem />
      </Container>
    );
  }
}
49
ответ дан akhil xavier 15 November 2017 в 13:55
поделиться

вы должны зайти в node_modules / yourPlugin / index.js, найти fontFamily и удалить его

0
ответ дан Naved Khan 15 November 2017 в 13:55
поделиться

Этот новый код для expo SDK 35, который был изменен из ответа @akhil xavier

Первый шрифт экспо установки

expo install 'expo-font'

здесь, является App.js

import React from "react";
import * as Font from "expo-font";
import { ActivityIndicator } from "react-native";
import { Root } from "native-base";

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = { loading: true };
  }

  async componentWillMount() {
    await Font.loadAsync({
      Roboto: require("native-base/Fonts/Roboto.ttf"),
      Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
      Ionicons: require("@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Ionicons.ttf"),
    });
    this.setState({ loading: false });
  }

  render() {
    if (this.state.loading) {
      return <ActivityIndicator />;
    }
    return (
      <Root>
       <RootPage /> // starter component (i.e. nav)
      </Root>
    );
  }
}
2
ответ дан 28 November 2019 в 23:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: