我有以下Snack Expo
:
https://snack.expo.io/rJ4mAxhmV
然后,我尝试将react-navigation
的版本更新为3.0.9
,结果如下:
https://snack.expo.io/rkPpag2mV
这是我应用于初始项目的唯一更改:
下面的文本模式:
diff --git a/App.js b/App.js
index 7f4eaf7..09ff71d 100644
--- a/App.js
+++ b/App.js
@@ -10,7 +10,7 @@ import {
type Theme,
} from 'react-native-paper';
import createReactContext from 'create-react-context';
-import { createDrawerNavigator } from 'react-navigation';
+import { createDrawerNavigator, createAppContainer } from 'react-navigation';
import RootNavigator from './src/RootNavigator';
import DrawerItems from './DrawerItems';
@@ -21,7 +21,7 @@ type State = {
const PreferencesContext: any = createReactContext();
-const App = createDrawerNavigator(
+const DrawerNavigator = createDrawerNavigator(
{ Home: { screen: RootNavigator } },
{
contentComponent: () => (
@@ -42,6 +42,8 @@ const App = createDrawerNavigator(
}
);
+const App = createAppContainer(DrawerNavigator);
+
export default class PaperExample extends React.Component<{}, State> {
state = {
theme: DefaultTheme,
diff --git a/package.json b/package.json
index 4e6d18a..eb2aec0 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,6 @@
"prop-types": "^15.0.0",
"react-lifecycles-compat": "^3.0.4",
"react-native-paper": "2.4.0",
- "react-navigation": "^2.18.2"
+ "react-navigation": "^3.0.9"
}
}
\ No newline at end of file
我的问题是,当单击列表上的任何条目时,我都会收到错误消息:
Device: (3:209750) TypeError: TypeError: e._panGestureHandler.current.setNativeProps is not a function. (In 'e._panGestureHandler.current.setNativeProps({hitSlop:s,activeOffsetX:u*o})', 'e._panGestureHandler.current.setNativeProps' is undefined)
如您所见:
关于如何解决此问题的任何想法?
请尽可能提供固定了Snack Expo
的链接。
谢谢!
答案 0 :(得分:2)
^ 3.0.9与3.1.0匹配,这取决于只能在SDK32或更高版本中使用的更新版本的react-native-gesture-handler。我建议将版本从“ ^ 3.0.9”更改为“ 3.0.9”或更改为SDK32。
这是工作小吃:https://snack.expo.io/@react-navigation/react-native-paper