react-native 0.19.0的react-native-maps集成问题

德武

按照添加react-native-maps的说明,添加到MainActivity中:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);

    mReactInstanceManager = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setBundleAssetName("index.android.bundle")
            .setJSMainModuleName("index.android")
            .addPackage(new MainReactPackage())
            .addPackage(new AirPackage()) // <---- and This!
            .setUseDeveloperSupport(BuildConfig.DEBUG)
            .setInitialLifecycleState(LifecycleState.RESUMED)
            .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "MelBike", null);

    setContentView(mReactRootView);

}

我遇到了这个异常:

java.lang.AssertionError: Attached DialogModule to host with pending alert but no FragmentManager (not attached to an Activity).
                                                           at com.facebook.infer.annotation.Assertions.assertNotNull(Assertions.java:28)
                                                           at com.facebook.react.modules.dialog.DialogModule.onHostResume(DialogModule.java:199)
                                                           at com.facebook.react.bridge.ReactContext.onResume(ReactContext.java:140)
                                                           at com.facebook.react.ReactInstanceManagerImpl.moveReactContextToCurrentLifecycleState(ReactInstanceManagerImpl.java:761)
                                                           at com.facebook.react.ReactInstanceManagerImpl.setupReactContext(ReactInstanceManagerImpl.java:599)
                                                           at com.facebook.react.ReactInstanceManagerImpl.access$700(ReactInstanceManagerImpl.java:84)
                                                           at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.onPostExecute(ReactInstanceManagerImpl.java:187)
                                                           at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.onPostExecute(ReactInstanceManagerImpl.java:162)
                                                           at android.os.AsyncTask.finish(AsyncTask.java:651)
                                                           at android.os.AsyncTask.-wrap1(AsyncTask.java)
                                                           at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                           at android.os.Looper.loop(Looper.java:148)
                                                           at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

这是react本机代码DialogModule类中的异常的来源:

public void onHostResume() {
mIsInForeground = true;
// Check if a dialog has been created while the host was paused, so that we can show it now.
FragmentManagerHelper fragmentManagerHelper = getFragmentManagerHelper();
Assertions.assertNotNull(
    fragmentManagerHelper,
    "Attached DialogModule to host with pending alert but no FragmentManager " +
    "(not attached to an Activity).");
fragmentManagerHelper.showPendingAlert();

我试图注释掉DialogModule类中的断言,然后运行react-native run-android,但似乎未反映在模拟器中运行的编译代码中。

也试过设置LifecycleState.RESUMEDLifecycleState.BEFORE_RESUME但随后的应用程序只加载空白的屏幕和菜单开发是不正常。

我想念什么吗?

文字开始

其余活动看起来如何?我遇到了这个问题,但问题是我没有在我的活动中实现DefaultHardwareBackBtnHandler

这是它们的实现方式:

@Override
protected void onPause() {
    super.onPause();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onPause();
    }
}

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onResume( this, this );
    }
}

@Override
public void onBackPressed() {
    if (mReactInstanceManager != null) {
        mReactInstanceManager.onBackPressed();
    } else {
        super.onBackPressed();
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

React Native Plaid 集成

来自分类Dev

TypeError:(0,_reactNavigationDrawer.createAppContainer)不是函数:React Native Error

来自分类Dev

可能未处理的 Promise Rejection (id: 0) React Native AsyncStorage

来自分类Dev

与React Native的持续集成

来自分类Dev

React Native Maps followUserLocation坐标

来自分类Dev

如何在React Native中安装React Native Maps?

来自分类Dev

React Native:更新ListView问题

来自分类Dev

React-native安装问题

来自分类Dev

React Native 中的 AsyncStorage 问题

来自分类Dev

react-native-elements安装问题与react-native

来自分类Dev

React Native:标签和堆栈导航集成

来自分类Dev

在React Native App中将Relay与Redux集成

来自分类Dev

将 android 项目集成到 React Native

来自分类Dev

将 Boilerplate Ignite 与 React Native 集成

来自分类Dev

react-native-maps构建失败

来自分类Dev

React Native:添加Google Maps SDK

来自分类Dev

React-Native-Maps JSON标记示例

来自分类Dev

React Native Maps - 空对象参考

来自分类Dev

无法从 react-native-maps 渲染 <MapView/>

来自分类Dev

React-native-maps 安装失败

来自分类Dev

Auth0规则无法通过React Native App进行API调用

来自分类Dev

在React Native中删除数量为0的数组中的项目

来自分类Dev

React Native Animated如何实现ReLU(负x的y = 0,正x的y = x)

来自分类Dev

(0,_helperModuleTransforms.getModuleName)不是一个函数-React Native

来自分类Dev

通过rest API react native/spring boot为0或null的值

来自分类Dev

React Native:可能未处理的承诺拒绝(ID:0):类型错误:未定义不是对象

来自分类Dev

React Native Mailer(RNMail)-附加文件问题

来自分类Dev

React Native中DatePickerIOS的prop问题

来自分类Dev

React Native:ScrollView内部的TouchableOpacity onPress问题

Related 相关文章

  1. 1

    React Native Plaid 集成

  2. 2

    TypeError:(0,_reactNavigationDrawer.createAppContainer)不是函数:React Native Error

  3. 3

    可能未处理的 Promise Rejection (id: 0) React Native AsyncStorage

  4. 4

    与React Native的持续集成

  5. 5

    React Native Maps followUserLocation坐标

  6. 6

    如何在React Native中安装React Native Maps?

  7. 7

    React Native:更新ListView问题

  8. 8

    React-native安装问题

  9. 9

    React Native 中的 AsyncStorage 问题

  10. 10

    react-native-elements安装问题与react-native

  11. 11

    React Native:标签和堆栈导航集成

  12. 12

    在React Native App中将Relay与Redux集成

  13. 13

    将 android 项目集成到 React Native

  14. 14

    将 Boilerplate Ignite 与 React Native 集成

  15. 15

    react-native-maps构建失败

  16. 16

    React Native:添加Google Maps SDK

  17. 17

    React-Native-Maps JSON标记示例

  18. 18

    React Native Maps - 空对象参考

  19. 19

    无法从 react-native-maps 渲染 <MapView/>

  20. 20

    React-native-maps 安装失败

  21. 21

    Auth0规则无法通过React Native App进行API调用

  22. 22

    在React Native中删除数量为0的数组中的项目

  23. 23

    React Native Animated如何实现ReLU(负x的y = 0,正x的y = x)

  24. 24

    (0,_helperModuleTransforms.getModuleName)不是一个函数-React Native

  25. 25

    通过rest API react native/spring boot为0或null的值

  26. 26

    React Native:可能未处理的承诺拒绝(ID:0):类型错误:未定义不是对象

  27. 27

    React Native Mailer(RNMail)-附加文件问题

  28. 28

    React Native中DatePickerIOS的prop问题

  29. 29

    React Native:ScrollView内部的TouchableOpacity onPress问题

热门标签

归档