मैं अपने ऐप विकास के लिए प्रतिक्रिया नेविगेशन का उपयोग कर रहा हूं। जब मैं लॉग-एंड्रॉइड चलाता हूं, तो यह इस तरह कुछ लॉगिंग करता रहता है।प्रतिक्रिया नेविगेशन में कंसोल लॉग अक्षम करें
नेविगेशन डिस्पैच: क्रिया: {...}, न्यू राज्य: {...}
जो createNavigationContainer.js लाइन से है 150
मैं GitHub के माध्यम से चलाने की है और दस्तावेज़ यह कहा शीर्ष स्तर के नेविगेटर पर NavigationStateChange = {null} को सेट करके किया जा सकता है।
मैं NavigationStateChange = {null} पर सेट करके इसे कैसे प्राप्त कर सकता हूं और मुझे इसे कहां सेट करना चाहिए?
मैंने नीचे की तरह सेट करने का प्रयास किया है, लेकिन यह पृष्ठ दूसरे पृष्ठ पर रीडायरेक्ट करने में सक्षम नहीं होगा।
export default() => {
<App onNavigationStateChange={null} />
}
नीचे मेरी app.js कोड हैं
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View } from 'react-native';
import { StackNavigator,DrawerNavigator } from 'react-navigation';
import DrawerContent from './components/drawer/drawerContent.js';
import News from './components/news/home.js';
const drawNavigation = DrawerNavigator(
{
Home : {
screen : News ,
navigationOptions : {
header : null
}
}
},
{
contentComponent: props => <DrawerContent {...props} />
}
)
const StackNavigation = StackNavigator({
Home : { screen : drawNavigation,
navigationOptions: {
header: null
}
}
});
export default StackNavigation;
यह मेरा drawerContent.js
import React, {Component} from 'react'
import {View,Text, StyleSheet,
TouchableNativeFeedback,
TouchableOpacity,
TouchableHighlight
} from 'react-native'
import { DrawerItems, DrawerView } from 'react-navigation';
import Icon from 'react-native-vector-icons/Octicons';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
class DrawerContent extends Component {
constructor(props){
super(props);
console.log('DrawerContent|testtttttt');
}
render(){
return (
<View style={styles.container}>
<Text>Hi darren</Text>
<TouchableOpacity style={{ marginBottom:5 }} onPress={() => this.props.navigation.navigate('RegistrationScreen') } >
<View style={styles.nonIconButton}>
<Text style={{ color: 'black',fontSize: 13 }} >Sign Up</Text>
</View>
</TouchableOpacity>
<Text>Hi darren</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default DrawerContent;
मुझे नहीं पता कि डिफ़ॉल्ट 'ऑनविगेशनस्टेट चेंज' फ़ंक्शन इतना धीमा प्रदर्शन क्यों करता है, भले ही यह धीमा प्रदर्शन करे। कोई समझ नहीं आता –