为什么我的 Expo 应用程序不发送消息?
Why is my Expo app not sending the messages?
我有一个用 Expo 和 wing 创建的应用程序,它有一个联系表,可以从中发送查询。
我已经开始使用已经构建的应用程序,我只是在设置我的数据。
问题是发送的查询没有到达我在配置中建立的邮件,在文件 (config.php) 中,因此消息必须以 smtp 模式到达
这是我的服务器配置:
$emailConfig = array(
'address' => 'xxxxxxx',
'password' => 'xxxx',
'name' => 'jose',
'smtp_host' => 'smtp.xxxx.es',
'smtp_port' => '587',
'smtp_encrypt' => 'tls'
);
应用程序,当我点击 SEND 时,调试控制台显示如下:
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的了解还不多,我不知道这个错误是什么意思,我已经搜索了没有成功的答案。
不知道我的展示是否足够让你帮到我
终于发现错误了,初学者的错误
我解释一下如果另一个用户和我一样。
问题是我没有编辑后端代码。我的意思是我在本地处理项目,后端在服务器上。
我修改了本地文件中的代码,但没有将更新上传到服务器
这就是未发送来自应用程序的消息的原因
我希望这可以帮助其他人,这让我觉得在寻求帮助和解决方案之前必须检查所有可能的错误。
感谢这个精彩的网站
我有一个用 Expo 和 wing 创建的应用程序,它有一个联系表,可以从中发送查询。
我已经开始使用已经构建的应用程序,我只是在设置我的数据。 问题是发送的查询没有到达我在配置中建立的邮件,在文件 (config.php) 中,因此消息必须以 smtp 模式到达 这是我的服务器配置:
$emailConfig = array(
'address' => 'xxxxxxx',
'password' => 'xxxx',
'name' => 'jose',
'smtp_host' => 'smtp.xxxx.es',
'smtp_port' => '587',
'smtp_encrypt' => 'tls'
);
应用程序,当我点击 SEND 时,调试控制台显示如下:
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的了解还不多,我不知道这个错误是什么意思,我已经搜索了没有成功的答案。 不知道我的展示是否足够让你帮到我
终于发现错误了,初学者的错误 我解释一下如果另一个用户和我一样。
问题是我没有编辑后端代码。我的意思是我在本地处理项目,后端在服务器上。 我修改了本地文件中的代码,但没有将更新上传到服务器 这就是未发送来自应用程序的消息的原因
我希望这可以帮助其他人,这让我觉得在寻求帮助和解决方案之前必须检查所有可能的错误。 感谢这个精彩的网站