javascript - undefined 不是对象(评估 '_reactNative.Stylesheet.create' )

标签 javascript android ios react-native

<分区>

我收到的是讨厌的错误“undefined is not an object (evaluating '_reactNative.Stylesheet.create')”,也可以在屏幕截图中看到。

以下是我使用的代码;

import React, {Component} from 'react';
import {Text, Stylesheet} from 'react-native';
import {Content, Container, Body, Title} from 'native-base';
import GoogleStaticMap from 'react-native-google-static-map';

export default class Contact extends Component {
  render() {
    return (
      <GoogleStaticMap
      style={styles.map}
      latitude={'32.064171'}
      longitude={'34.7748068'}
      zoom={13}
      size={{
      width: 300,
      height: 550
    }}
    />);
  }
}

const styles = Stylesheet.create({
  map: {
    width: 300,
    height: 550
  }
});

module.export = Contact;

最佳答案

在 Sheet 上使用大写的 StyleSheet

import {Text, StyleSheet} from 'react-native';
...
const styles = StyleSheet.create({

关于javascript - undefined 不是对象(评估 '_reactNative.Stylesheet.create' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44870827/

相关文章:

javascript - 我的模态 div 没有关闭

android - 无法转换 com.google.gson.internal.LinkedTreeMap

ios - 在上下文中绘制 View ,这是什么意思?

ios - UILocalNotification 2 分钟后重复提醒

javascript - 有没有办法使用 .split 将字符串拆分为数组

javascript - 为什么我不能为元素设置过渡

android - 为同一提供者使用多个 LocationManager requestLocationUpdates(...)

java - 如何在我的应用程序中实现 Google 语音输入?

ios - 在不使用 CollectionView 的情况下在 GridView 中列出 UIButton

javascript - 当数组作为依赖项传递时,React 中的 useEffect 会在无限循环中运行