我的项目有问题。
类型错误:预期的动态类型为“double”,但类型为“null”
在呈现此表单之前,应用程序会不时出现错误,但并不总是出现错误。我认为只有当互联网不是很好。但我希望能够处理这个错误,所以它不会出现在用户面前。
我的代码如下。
表单主体.js
import React, { Component } from 'react';
import { View, Text, ScrollView, Alert, BackHandler } from 'react-native';
import RNExitApp from 'react-native-exit-app';
import ScrollableTabView from 'react-native-scrollable-tab-view';
import { Actions } from 'react-native-router-flux';
import axios from 'axios';
import { connect } from 'react-redux';
import { modificaToken, modificaConsultas, modificaScene } from '../actions/AutenticacaoActions';
import FormFaturamento from './FormFaturamento';
import FormListaConsultas from './FormListaConsultas';
class formPrincipal extends Component {
componentWillMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleAndroidBack)
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleAndroidBack)
}
handleAndroidBack = () => {
if(Actions.currentScene === 'formPrincipal') {
Alert.alert(
'Sair',
'Deseja sair do app?',
[
{ text: 'NÃO', onPress: () => {} },
{ text: 'SIM', onPress: () => RNExitApp.exitApp() },
]
);
return true;
}
}
render() {
return(
<ScrollableTabView>
{this.props.consultas.map( item => <FormListaConsultas tabLabel={item.Grupo} key={item.Grupo} item={item}/>)}
</ScrollableTabView>
)
}
}
const mapStateToProps = state => (
{
token: state.AutenticacaoReducer.token,
consultas: state.AutenticacaoReducer.consultas,
scene: state.AutenticacaoReducer.scene,
listaConsultas: state.AutenticacaoReducer.listaConsultas
}
)
export default connect(mapStateToProps, {modificaToken, modificaConsultas, modificaScene})(formPrincipal);
Run Code Online (Sandbox Code Playgroud)
我通过关闭 Android 的本机动画驱动程序解决了这个错误。我不确定这是一个真正的答案,但它为我修复了这个特定的错误。
Animated.timing(someAnimation, {
duration: 5000,
toValue: 1,
useNativeDriver: false,
}).start();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6360 次 |
| 最近记录: |