尝试从React-Navigation实施Navigators时,我遇到了一些奇怪的行为。
从https://reactnavigation.org/docs/en/hello-react-navigation.html ...
尝试简单的“hello world”时import React from 'react';
import { View, Text } from 'react-native';
import { createStackNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
</View>
);
}
}
export default createStackNavigator({
Home: {
screen: HomeScreen,
},
});
我收到此错误:
不变违规:元素类型无效:期望一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:object。 检查'SceneView'的渲染方法。
奇怪的是,当使用StackNavigator(和TabNavigator)给我不可侵犯时,使用DrawerNavigator不会!
This common fix (removing the braces in the import) gives a new error:
对象不是函数
我是React-Native的新手,不知道如何深入研究这个问题,感谢任何帮助!
- - - - 修改 -----
我已将我的react-navigation版本降级到v1.5.5并且原始StackNavigator组件正常工作,所以这可能与v2.0.1和我的环境存在兼容性问题。
答案 0 :(得分:3)
如果您的Sub Connection()
Dim Conn As ADODB.Connection
Dim Command As ADODB.Command
Set Conn = New ADODB.Connection
Set Command = New ADODB.Command
Dim i As Integer
Dim rownumber As Integer
rownumber = Sheets("Sheet1").Range("A1048576").End(xlUp).Row
Conn.ConnectionString = "Provider=SQLOLEDB; Data Source=[Server];Initial Catalog=[DB];User ID=[user];Password=[Password]; Trusted_Connection=no"
Conn.Open
Command.ActiveConnection = Conn
For i = 1 To rownumber 'rows
If ActiveSheet.Cells(i, 8).Value = "Y" Then GoTo NextIteration
Else
Command.CommandText = "INSERT INTO [Database] (" & _
"[Col1], [Col2], [Col3], [Col4], [Col5], [Col6], [Col7])" & _
"VALUES (" & _
"'" & ActiveSheet.Cells(i, 1).Value & "'," & _
"'" & ActiveSheet.Cells(i, 2).Value & "'," & _
"'" & ActiveSheet.Cells(i, 3).Value & "'," & _
"'" & ActiveSheet.Cells(i, 4).Value & "'," & _
"'" & ActiveSheet.Cells(i, 5).Value & "'," & _
"'" & ActiveSheet.Cells(i, 6).Value & "'," & _
"'" & ActiveSheet.Cells(i, 7).Value & "')"
Command.Execute
ActiveSheet.Cells(i, 8).Value = "Y"
End If
Next i
Conn.Close
Set Conn = Nothing
End Sub
拥有正确的react
版本,请检入package.json。例如,
react-native
不适合我,但是
"react": "16.4.0",
"react-native": "^0.53",
"react-navigation": "^2.0.4",
作品。
答案 1 :(得分:0)
我可能已经找到了你的问题。我认为您正在尝试按照错误版本的文档进行操作。我假设你正在使用反应导航的V1。
您可以通过在项目根目录中的终端中运行“yarn list react-navigation”来查看当前安装的版本。
V1文档:https://v1.reactnavigation.org/docs/hello-react-navigation.html
如果我使用上面链接中的示例,一切正常。也许你可以尝试一下?
标记