0
React Nativeで次のエラーが発生し、同じ問題を抱えた複数の投稿を見て、まだこれを解決する運を持っていないm。この問題の原因を正確に把握できません。 HEREReactネイティブエラー "未定義はオブジェクトではありません(評価 '_this2.props.navigation.navigate')"
は、ここに私のAPP.JSのCODE
import * as Expo from 'expo';
import React from 'react';
import { StyleSheet, Text, AppRegistry, View, Image, TouchableOpacity, FlatList } from 'react-native';
import { StackNavigator } from 'react-navigation';
import { withNavigation } from 'react-navigation';
import HostClient from './app/Views/HostClientView';
import ClientQueue from './app/Views/ClientQueue';
import SearchBarr from './app/components/Searchbar';
export default class App extends React.Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
return (
<Image style = {styles.container} source={require('./app/images/jukebox-background.jpg')} resizeMode="cover">
<View>
<HostClient />
</View>
</Image>
);
}
const SimpleApp = StackNavigator({
HostClientView: { screen: HostClient },
ClientQueueView: { screen: ClientQueue},
});
は、私はすべてのコンポーネント
import React from 'react';
import { StyleSheet, Text, AppRegistry, View, Image, TouchableOpacity,
FlatList } from 'react-native';
import Host from '../../components/Host/Host.js';
import UserRequest from '../../components/UserRequest/UserRequest.js';
import { StackNavigator } from 'react-navigation';
import Button from 'react-native-button';
export default class HostClient extends React.Component {
render() {
return (
<View>
<Host />
<UserRequest />
<Button style = {styles.button} title="ClientQueueView"
onPress={() => this.props.navigation.navigate('ClientQueueView') }> <Image style = {styles.turntable} source={require('../../images/vinyl2.png')} resizeMode="contain"/>
</Button>
</View>
);
}
}
WITH MAIN VIEWを作り、最終的にここuser.jsファイル
IS MY HOSTCLIENT.JS IS IS// Request Component
import React, { Component } from 'react';
import { StyleSheet, AppRegistry, Text, View, Image } from 'react-
native';
import Button from 'react-native-button';
import { StackNavigator } from 'react-navigation';
export default class UserRequest extends Component {
static navigationOptions = ({navigation}) => {
const {state, navigate} = navigation;
return {
title: 'Noah Testing'
};
};
constructor() {
super();
this.state = {
address: [],
refreshing: false,
page: 1,
lastPage: 1,
loading: true,
listOpacity: 0,
};
}
render() {
return (
<View >
<Text > Request </Text>
<Button title="ClientQueueView"
onPress={() => this.props.navigation.navigate('ClientQueueView') }> <Image style = {styles.turntable} source={require('../../images/vinyl2.png')} resizeMode="contain"/>
</Button>
</View>
);
}
}
エラーの原因となっているのは、どの回線ですか? –
それを見つけました。ロットの一般的な誤り。 –