reactjs - React Native unought typeerror: u.split is not a function
问题描述
我正在开发一个带有 react native 和 firebase 的应用程序。在搜索字段中,当我输入搜索输入时,它给了我以下错误:
这是我的代码:(一切都是进口的)
export default function Search(props) {
const [users, setUsers] = useState([])
const fetchUsers = (search) => {
firebase.firestore()
.collection(users)
.where("name", ">=", search)
.get()
.then((snapshot) => {
let users = snapshot.docs.map(doc => {
const data = doc.data();
const id = doc.id;
return { id, ...data }
});
setUsers(users);
})
}
return (
<View>
<TextInput placeholder="Serach..." onChangeText={(search) => fetchUsers(search)} />
<FlatList
numColumns={1}
horizontal={false}
data={users}
renderItem={({ item }) => (
<TouchableOpacity
onPress={() => props.navigation.navigate("Profile", { uid: item.id })}>
<Text>{item.name}</Text>
</TouchableOpacity>
)}
/>
</View>
)
}
解决方案
推荐阅读
- c - 如何在 ac 函数中返回通用指针?
- django - Django 使用包含文件字段的外部 postgresql 数据库
- r - Trying to install easyGgplot2 in R
- matlab - 如何在 MATLAB 的子图中对齐 xlabels 和 ylabels
- python-3.x - scipy 的 wavfile.read 函数的输出
- c - 奇怪的 C 分段错误
- javascript - 激活路由后如何缓存组件
- node.js - 来自 mongo db 的节点输出作为对象列表
- javascript - 如何将索引从 *ngFor 附加到 attr.id - HTML
- swift - 在 Xcode 中为 LLDB 调试器添加快捷方式以进行 Swift 调试