javascript - 为什么我的 Expo 应用程序不发送消息?
问题描述
我有一个使用 Expo 创建的应用程序和带有用于发送查询的联系表的 Wing。
我已经从已经构建的应用程序开始,我只是在设置我的数据。问题是发送的查询没有到达我在配置中建立的邮件,在文件(config.php)中,因此消息必须以 smtp 模式到达这是我的服务器配置:
$emailConfig = array(
'address' => 'xxxxxxx',
'password' => 'xxxx',
'name' => 'jose',
'smtp_host' => 'smtp.xxxx.es',
'smtp_port' => '587',
'smtp_encrypt' => 'tls'
);
当我单击“发送”时,应用程序调试控制台会显示以下内容:
Toast is not defined
* application/components/PlaceFav.js:82:10 in render
- node_modules/react-native/node_modules/promise/setimmediate/core.js:37:11 in tryCallOne
- node_modules/react-native/node_modules/promise/setimmediate/core.js:123:14 in setImmediate$argument_0
- ... 8 more stack frames from framework internals
控制台输出引用的文件如下,行:
renderItem={({item, index}) =>
import React, {Component} from 'react';
import * as firebase from 'firebase';
import { NavigationActions, StackNavigator, withNavigation} from 'react-navigation';
import{AsyncStorage, TouchableOpacity, Dimensions, View, Image, ScrollView, FlatList} from 'react-native';
import Icon from 'react-native-vector-icons/SimpleLineIcons';
import { Container, Body, Thumbnail, Text, List, Right, ListItem} from 'native-base';
import ConfigApp from '../utils/ConfigApp';
import FavListEmpty from './FavListEmpty';
import Strings from '../utils/Strings';
var styles = require('../../assets/files/Styles');
var {height, width} = Dimensions.get('window');
class PlaceFav extends React.Component {
constructor(props) {
super(props);
this.state = {
places: []
}
}
componentDidMount () {
this.fetchPlaces();
}
PlaceDetails (item) {
const navigateAction = NavigationActions.navigate({
routeName: 'PlaceDetailsScreen',
params: {item}
});
this.props.navigation.dispatch(navigateAction);
}
renderFooterPlaces = () => {
const places = this.state.places
if (places.length != 0) return null;
return (
<FavListEmpty/>
);
};
removePlace = async (place_id) => {
try {
var user = firebase.auth().currentUser;
uid = user.uid;
const places = await AsyncStorage.getItem('places');
let placesFav = JSON.parse(places);
placesItems = placesFav.filter(function(e){ return e.place_id !== place_id && e.userId == uid })
await AsyncStorage.setItem('places', JSON.stringify(placesItems));
this.setState({
...this.state,
places: placesItems || []
});
} catch(error) {
}};
render () {
return (
<List>
<ListItem itemDivider>
<Text>{Strings.ST1}</Text>
</ListItem>
<FlatList
data={this.state.places}
refreshing="true"
renderItem={({item, index}) =>
<ListItem style={{paddingLeft: 0, marginLeft: 0, backgroundColor:'#FFF', opacity: 1, borderColor: 'rgba(0,0,0,0.05)', borderBottomWidth: 1}} onPress={() => this.PlaceDetails(item)} >
<Thumbnail rounded size={80} source={{ uri: ConfigApp.URL+'images/'+item.place_image }} style={{paddingLeft: 10, marginLeft: 10}} />
<Body style={{paddingLeft: 0, marginLeft: 0}}>
<Text numberOfLines={2} style={{fontSize: 14, marginBottom: 3}}>
{item.place_name}
</Text>
</Body>
<Right>
<TouchableOpacity onPress={this.removePlace.bind(this, item.place_id)} activeOpacity={1}>
<Text note>
<Icon name="close" style={{fontSize: 19}}/>
</Text>
</TouchableOpacity>
</Right>
</ListItem>
}
keyExtractor={(item, index) => index.toString()}
ListFooterComponent={this.renderFooterPlaces}
/>
</List>
)
}
async fetchPlaces () {
var user = firebase.auth().currentUser;
uid = user.uid;
let placesJSON= await AsyncStorage.getItem('places');
let placesFav = JSON.parse(placesJSON);
placesItems = placesFav.filter(function(e){
return e.userId == uid
})
const placesArray = placesItems || [];
this.setState({
...this.state,
places: placesArray
});
}
}
export default withNavigation(PlaceFav);
我对 Javascript 和 php 中的 React 还没有太多了解,我不知道这个错误是什么意思,我一直在寻找答案但没有成功。我不知道我展示的内容是否足以让你帮助我
解决方案
我终于发现了这个错误,一个初学者的错误,如果另一个用户和我一样,我会解释它。
问题是我没有编辑后端代码。我的意思是我正在本地处理该项目,而后端位于服务器上。我修改了本地文件中的代码,但它没有将更新上传到服务器这就是没有发送来自应用程序的消息的原因
我希望这可以对其他人有所帮助,这让我认为您必须在寻求帮助和解决方案之前检查所有可能的错误。感谢这个精彩的网站
推荐阅读
- ssl - kubectl 在 Linux 上回复连接被拒绝,而在另一台机器(Mac)上正常
- node.js - Nginx 删除删除第二个斜线
- python - os.join() 的奇怪行为
- javascript - 为 Typescrpit 3.2 及更高版本将 .ts 文件编译为 .js
- android - 在我的 android 上发现了这个问题:AAPT: error: not well-formed (invalid token)
- php - 使用 joomla 检查 MYSQLDatabase 中是否存在记录
- python - 以不同的维度滚动数组轴(概括跨步索引滚动)
- reactjs - 在反应中是否有任何方法可以等待子组件状态并与子组件一起重新渲染父组件
- javascript - 根据 express route 中的值从 mongodb 获取数据
- python - Pandas 数据清理以分配行下方的记录被分配一个特定的值