如何解决UIManager ['AIRMapLite']不再受支持。 (带有白色徽标的白色屏幕)

问题描述 投票:1回答:1

我在过去的两天里无法解决这个问题。我已经完成了mapview的搜索和阅读,但仍无法解决。

Error

我会告诉你我的代码和我做的场景。

我的导入

import MapView from 'react-native-maps';

我的功能

    export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <MapView
          zoomEnabled = {true}
          style={ styles.map }
          initialRegion={{
            latitude: 37.78825,
            longitude: -122.4324,
            latitudeDelta: 0.0922,
            longitudeDelta: 0.0421,
          }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  map: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    ...StyleSheet.absoluteFillObject,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

最后是谷歌的激活密钥

<meta-data 
        android:name="com.google.android.geo.API_KEY"
        android:value="i make it secret first"
      />

Activate

这是我的控制台中的错误,我不知道问题发生了

    if (__DEV__) {
  Object.keys(UIManager).forEach(viewManagerName => {
    if (!UIManagerProperties.includes(viewManagerName)) {
      if (!viewManagerConfigs[viewManagerName]) {
        viewManagerConfigs[viewManagerName] = UIManager[viewManagerName];
      }
      defineLazyObjectProperty(UIManager, viewManagerName, {
        get: () => {
          console.warn(
            `Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` +
              `is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`,
          );
          return UIManager.getViewManagerConfig(viewManagerName);
        },
      });
    }
  });
}
react-native android-mapview
1个回答
0
投票

这是react-native-maps目前的一个已知问题。 issue最初创建于2018年12月。

这实际上是依赖关系如何实现的问题。因此,除了分配回购,并自己解决潜在问题之外,没有什么可以做的。

截至2019年3月11日,它现在已经修复,不应再成为问题。该修复程序已包含在下一版本中。因此,一旦react-native-maps的下一个版本发布,您就不应再遇到警告了。

https://github.com/react-native-community/react-native-maps/issues/2620#issuecomment-471650689

固定在master上,应该包含在下一个版本中

如果您不能等待问题得到修复并且您想要隐藏YellowBox警告,您可以使用以下方法来执行此操作

import {YellowBox} from 'react-native';

然后在你的渲染方法中,我通常在App.js中进行,所以很容易跟踪我隐藏的那些。

render() {
  YellowBox.ignoreWarnings(['Warning: ...']);  // <- insert the warning text here you wish to hide. 
  return (
    //cool ui stuff
  );
}

它不会从控制台中删除警告,但会删除与错误相关的任何YellowBox警告。

© www.soinside.com 2019 - 2024. All rights reserved.