Android Среда эмулятора: Pixel_3_XL_API_29
Всякий раз, когда я использую любой компонент реагирующей навигации, такой как стек или ящик, в моем приложении, основанном на экспо, и щелкаю мышью в любом месте экрана, происходит сбой. Если я удаляю
<AppContainer />
в приведенном ниже примере и заменяю его на
<LoginScreen/>
, все работает нормально. Примечание: LoginScreen - это просто пустой экран без собственных логов c.
Я вижу ошибку ниже в журналах adb
02-13 15:52:32.562 751 751 E MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
02-13 15:52:32.562 751 751 E MessageQueue-JNI: java.lang.IllegalStateException: Already prepared or hasn't been reset
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.prepare(GestureHandler.java:7)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordHandlerIfNotPresent(GestureHandlerOrchestrator.java:8)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordViewHandlersForPointer(GestureHandlerOrchestrator.java:5)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.traverseWithPointerEvents(GestureHandlerOrchestrator.java:12)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.extractGestureHandlers(GestureHandlerOrchestrator.java:5)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:4)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:2)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:1)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
02-13 15:52:32.562 751 751 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2698)
package. json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start -c",
"doctor": "expo doctor",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "0.1.5",
"react-navigation-stack": "2.1.1",
"react-navigation": "4.1.1",
"axios": "0.19.2",
"debounce": "1.2.0",
"expo": "~36.0.0",
"expo-secure-store": "~8.0.0",
"native-base": "^2.13.8",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "^0.61.5",
"react-native-gesture-handler": "~1.5.0",
"react-native-reanimated": "~1.4.0",
"react-native-safe-area-context": "0.6.0",
"react-native-screens": "2.0.0-alpha.12",
"uuid": "3.4.0"
},
"devDependencies": {
"babel-preset-expo": "~8.0.0",
"@babel/core": "^7.0.0"
},
"private": true
}
Приложение. js
import 'react-native-gesture-handler';
import React from "react";
import { AppLoading } from "expo";
import * as Font from "expo-font";
import { Ionicons } from "@expo/vector-icons";
import MainMenu from './MainMenu'
import LoginScreen from './LoginScreen'
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
const navi = createStackNavigator({
Login: {
screen: LoginScreen,
},
Menu: {
screen: MainMenu,
}
}, {
initialRouteName: 'Login',
});
const AppContainer = createAppContainer(navi);
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isReady: false
};
}
async componentDidMount() {
await Font.loadAsync({
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
Ionicons: require("native-base/Fonts/Ionicons.ttf")
});
this.setState({ isReady: true });
}
render() {
if (!this.state.isReady) {
return <AppLoading />;
}
return (<AppContainer />);
}
}
Экран входа в систему
import React from "react";
import { Container, Header, Body, Title, List, ListItem, Content, Text } from "native-base";
export default class MainMenu extends React.Component {
constructor(props)
{
super(props);
}
render() {
return (
<Container>
<Header>
<Body>
<Title>Test</Title>
</Body>
</Header>
<Content>
</Content>
</Container>
);
}
}
Примечание: я получаю ту же ошибку с реакции навигации 4 и 5