Skip to content

Instantly share code, notes, and snippets.

View JorensM's full-sized avatar

Jorens Merenjanu JorensM

View GitHub Profile
@JorensM
JorensM / _layout.tsx
Created January 14, 2024 13:54
expo-router bug report
// app/_layout.tsx
import { Drawer } from 'expo-router/drawer';
export const unstable_settings = {
// Ensure any route can link back to `/`
initialRouteName: 'index',
};
import useAuth from '#hooks/useAuth';
import AuthContext from '#state/AuthContext';
import { User } from '#types/User';
import { router } from 'expo-router';
import { Drawer } from 'expo-router/drawer';
import { usePathname } from 'expo-router/src/hooks';
import { useEffect, useMemo, useState } from 'react';
export const unstable_settings = {
// Ensure any route can link back to `/`
@JorensM
JorensM / route.test.tsx
Created January 23, 2024 08:46
Layout route problem
describe('New Listing page', () => {
renderRouter({
'new-listing': NewListingPage,
'listings/[id]': ListingPage,
'feed': FeedPage,
'_layout': Layout
}, {
initialUrl: '/'
});
// ...
fireEvent.changeText(title_comp, TITLE)
fireEvent.changeText(description_comp, DESCRIPTION);
fireEvent.press(save_button); // This causes the route to change
await waitFor(() => expect(screen).toHavePathname('/listings/' + LISTING_ID), {timeout: 10 * 1000, interval: 1000});
const title_comp_2 = await waitFor(() => screen.getByText(TITLE)); // Error here
const description_comp_2 = await waitFor(() => screen.getByText(DESCRIPTION));
const author_comp = await waitFor(() => screen.getByText('By ' + AUTHOR_NAME));