I have a bug that I don't know where to begin. Tried to update the react-native version - but it didn't do the trick..
Environment
react-native-cli: 2.0.1
react-native: 0.54.2
Production build
The app is build and release to the google play store. So it is the compiled production version. Think it's an issue with the module perhaps.. but not quite sure..
this is my imports in the main component
import React, { Component } from 'react'
import { View, Modal, Text, TextInput, StyleSheet } from 'react-native'
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
Fullstack
java.lang.RuntimeException:
at com.facebook.react.bridge.ReactContext.handleException (ReactContext.java:313)
at com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:23)
at android.os.Handler.handleCallback (Handler.java:739)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:158)
at android.app.ActivityThread.main (ActivityThread.java:7225)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
Caused by: android.view.WindowManager$BadTokenException:
at android.view.ViewRootImpl.setView (ViewRootImpl.java:849)
at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:337)
at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:91)
at android.app.Dialog.show (Dialog.java:350)
at com.facebook.react.views.modal.ReactModalHostView.showOrUpdate (ReactModalHostView.java:256)
at com.facebook.react.views.modal.ReactModalHostManager.onAfterUpdateTransaction (ReactModalHostManager.java:107)
at com.facebook.react.views.modal.ReactModalHostManager.onAfterUpdateTransaction (ReactModalHostManager.java:28)
at com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:35)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:233)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:153)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:816)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:929)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2100 (UIViewOperationQueue.java:47)
at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:887)
at com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:21)
UPDATE
I use the modal 3 different places.
const Credits = ({ display, toggle }) => (
<View>
<TouchableOpacity
style={[styles.button, styles.info]}
onPress={() => toggle()}
>
<Icon name="question" size={30} color="#000" />
</TouchableOpacity>
{display && (
<Modal
animationType="slide"
transparent={true}
onRequestClose={() => toggle()}
>
<View style={styles.card}>
<ScrollView>
{ ... code ... }
</ScrollView>
<TouchableOpacity
style={[styles.button, styles.close]}
onPress={() => toggle()}
>
<Icon name="close" size={30} color="#000" />
</TouchableOpacity>
</View>
</Modal>
)}
</View>
)
Don't know if it is because I use { display && <Modal .../> }
logic instead of using the prop visible={display}
???
Any help would be highly appreciated!