skip to Main Content

I was trying to get Authentication to work with my simple app using ‘withAuthenticator’ with Amplify in React Native, but I encountered a bug for both iOS and Android, but for web view, the authentication works flawlessly.

For testing on iOS and Android via the scanning of the QR code of Expo Go, I encountered the following error (web view didn’t have this error):

Render Error
Text strings must be rendered within a <Text> component.
<WrappedWithAuthenticator /> 
withDevTools.ios.js:25 
<withDevTools(WrappedWithAuthenticator)/> 
renderApplication.js:57
5 more components

Here is what code I have for App.js:

import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import { Amplify } from 'aws-amplify';
import { withAuthenticator } from '@aws-amplify/ui-react';
import amplifyconfig from './src/amplifyconfiguration.json';

Amplify.configure(amplifyconfig);


import HomeScreen from './Screens/Home';
import DetailsScreen from './Screens/Details';


const Stack = createNativeStackNavigator();

const App = () => {

  return (
    <NavigationContainer>
      <Stack.Navigator initialRouteName = "Home" >
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );

};

export default withAuthenticator(App);

Any help is appreciated!

I’ve tried some random solutions like importting Text, Buttons, TouchableOpacities, etc., but this has not worked.

I’ve narrowed down the problem to be with the Amplify Authentication because the app runs properly on iOS and Android when the authentication isn’t in the app.

It’s a very strange issue since it works properly while testing on the web, but it doesn’t work on iOS or Android.

2

Answers


  1. Expo Go has some compatibilities issues with AWS Amplify V6. try to stick to the version 5 if you can . the problem Persist and I spent days trying to fix it I vain .
    Nonetheless, try to install your package with –legacy-peer-deps it may help you. I tried a the result was random . so I gave up on expo till things will be much clearer.

    Login or Signup to reply.
  2. I am having a similar issue here, It’s been 2 days since trying to fix the issue but could not find the solution.
    I am considering degrade Amplify version.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search