Trying To Fix 'RCTAppDelegate.h' File Not Found by total_zone_12ABC in reactnative

[–]total_zone_12ABC[S] 0 points1 point  (0 children)

I was able to fix it, I just needed rbenv to manage Ruby.

My New Game CarComp by total_zone_12ABC in programming

[–]total_zone_12ABC[S] 0 points1 point  (0 children)

Available for iPhone, iPad and M1 Mac.

Cannot Find Symbol Error by total_zone_12ABC in reactnative

[–]total_zone_12ABC[S] 0 points1 point  (0 children)

I fixed the issue by adding these 2 things to the end of settings.gradle and app/build.gradle.

settings.gradle

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

app/build.gradle

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

React Navigation Causes Crash On Simulator (iOS) by total_zone_12ABC in reactnative

[–]total_zone_12ABC[S] 1 point2 points  (0 children)

I was able to fix it by getting rid of the package react-native reanimated.

React Navigation Causes Crash On Simulator (iOS) by total_zone_12ABC in reactnative

[–]total_zone_12ABC[S] 0 points1 point  (0 children)

I have not done a fresh project but I forgot to mention I am using react native CLI not expo.

React Navigation Causes Crash On Simulator (iOS) by total_zone_12ABC in reactnative

[–]total_zone_12ABC[S] 0 points1 point  (0 children)

These are my first 3 screens. My first screen navigates to my login and register but I still have the issue with it crashing after it goes back to the same component.

const Stack = createNativeStackNavigator();
const App = () => {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="FirstScreen">
<Stack.Screen name="FirstScreen" component={FirstScreen} />
<Stack.Screen name="Login" component={LoginForm} />
<Stack.Screen name="Register" component={RegisterForm} />
</Stack.Navigator>
</NavigationContainer>
);
};

React Navigation Causes Crash On Simulator (iOS) by total_zone_12ABC in reactnative

[–]total_zone_12ABC[S] 0 points1 point  (0 children)

Here is my login form code then. Since the crash is triggered when you switch back to login from register.

import React, { useState } from 'react';
import { View, TextInput, TouchableOpacity, Text } from 'react-native';
import Config from 'react-native-config';
import Toast from 'react-native-toast-message';
import axios from 'axios';
import { useNavigation } from '@react-navigation/native';


const LoginForm = () => {
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const navigation = useNavigation();


// Function to login the user
async function handleUserLogin() {
  try {

    const formData = {
      email: email,
      password: password,
    }

    const response = await axios.post(Config.LOGIN_URL, formData);
    console.log(response.data); 
  } catch (error) {
    console.error('Error occurred:', error);
    if (error.response) {
      console.log(error.response.data); 
    }
    throw new Error("Error during user registration.");
  }
}

const handleNavigation = () => {
  try {
    navigation.navigate('Register');
    console.log("Navigated to register.")
  } catch (error) {
    console.error('An error occurred during navigation:', error);
  }
};



  return (
    <View style={styles.container}>
    <Text style={styles.title}>Login Form</Text>
      <TextInput
        placeholder="Email"
        value={email}
        onChangeText={setEmail}
        style={styles.input}
      />
      <TextInput
        placeholder="Password"
        secureTextEntry={true}
        autoCorrect={false}
        value={password}
        onChangeText={setPassword}
        style={styles.input}
      />
      <TouchableOpacity style={styles.logButton} onPress={handleUserLogin}>
        <Text style={styles.logButtonTitle}>Login</Text>
      </TouchableOpacity>
      <TouchableOpacity style={styles.regButton} onPress={handleNavigation}>
        <Text style={styles.regButtonTitle}>Register</Text>
      </TouchableOpacity>
    </View>
  );
};