我使用的是 Android 模拟器,因此我将users.db放在“android/app/src/main/assets/users.db”中。我已经跑了npx react-native link建立链接了。我使用的是带有自动链接功能的 React Native 6.0 以上版本。
我收到“错误:无法打开数据库”:
import React, {Component} from 'react'
import {View, Text, Alert} from 'react-native'
import SQLite from 'react-native-sqlite-storage'
export default class App extends Component {
constructor(props) {
super(props)
SQLite.openDatabase({name:'users', createFromLocation:1}, this.connected, this.failed)
}
connected= () =>{
Alert.alert('Connected with success !')
}
failed= (e) =>{
Alert.alert('Something went wrong !', `${e}`)
}
render(){
return(
<View>
<Text>Testing SQLite</Text>
</View>
)
}
}
Run Code Online (Sandbox Code Playgroud) 你们今天对react-native-vector-icons/FontAwesome 有问题吗?我使用的是react-native 版本>0.6,所以我认为问题不在于链接。
正如你们在图片中看到的那样,它没有显示我要求的任何图标,我不知道发生了什么......
这是我的 Android 模拟器上显示的图片: Print-Scream-Icon-Not-Showing-up
import React from 'react'
import {View, Text, StyleSheet, TouchableOpacity} from 'react-native'
import Icon from 'react-native-vector-icons/FontAwesome'
export default function ActionButton(props) {
return(
<TouchableOpacity>
<View style={styles.container}>
<Icon name='plus' size={30} color='#777' />
<Icon name='trash' size={30} color='#777' />
<Icon name='search' size={30} color='#777' />
</View>
</TouchableOpacity>
)
}
const styles = StyleSheet.create({
container:{
justifyContent:'center',
alignItems:'center',
width:80,
height:40,
backgroundColor:'#FFF',
elevation:9,
marginTop:20,
borderRadius:6,
paddingVertical:15,
marginBottom:10
}
})
Run Code Online (Sandbox Code Playgroud) react-native ×2
android ×1
font-awesome ×1
ios ×1
javascript ×1
react-native-sqlite-storage ×1
sqlite ×1