| bad6d389 | 25-Sep-2023 |
Mark Lawlor <[email protected]> |
fix(router): fix navigation with nested <Slot /> layouts (#24598)
# Why
Fixes: #24576
# How
We should be using `target` instead of `source` for our navigation.
# Test Plan
Added new t
fix(router): fix navigation with nested <Slot /> layouts (#24598)
# Why
Fixes: #24576
# How
We should be using `target` instead of `source` for our navigation.
# Test Plan
Added new test. Verified with reproduction from #24596
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 34a1b52d | 21-Sep-2023 |
Mark Lawlor <[email protected]> |
fix(router): correctly clone hoisted groups (#24218)
# Motivation
Fixes: https://github.com/expo/router/issues/805
Hoisted routes inside array groups were not being correctly cloned. The
matc
fix(router): correctly clone hoisted groups (#24218)
# Motivation
Fixes: https://github.com/expo/router/issues/805
Hoisted routes inside array groups were not being correctly cloned. The
matcher was not detecting the hoisted route and the cloning logic
assumed one set of groups, but a hoisted route may have many.
# Execution
* Updated `matchGroupName` regex to allow for leading/trailing folder
names.
* Updated `fileNodeToRouteNode` logic to extrapolate multiple array
groups
# Test Plan
Modified the example in https://github.com/expo/router/issues/805 to
include a set of nested groups as well.
File tree is
```
events/_layout // <Slot />
events/(manage,preview)/_layout // <Slot />
events/(manage,preview)/[eventId]
events/(manage,preview)/(a,b)/_layout // <Slot />
events/(manage,preview)/(a,b)/test
```
Current (2.0.4) Sitemap:

After:

---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 0afd420b | 20-Sep-2023 |
Evan Bacon <[email protected]> |
fix(router): prevent circular navigation references. (#24548)
# Why
- fix regression in https://github.com/expo/expo/pull/24457
# How
- clone objects to prevent circular references.
# Te
fix(router): prevent circular navigation references. (#24548)
# Why
- fix regression in https://github.com/expo/expo/pull/24457
# How
- clone objects to prevent circular references.
# Test Plan
- Added test that could repro the issue.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| da3c31f4 | 20-Sep-2023 |
Evan Bacon <[email protected]> |
chore(router): throw errors in tests (#24525)
# Why
- Ensure tests fail when an unhandled action occurs.
---------
Co-authored-by: Expo Bot <[email protected]> |
| fe80dcf9 | 19-Sep-2023 |
Mark Lawlor <[email protected]> |
fix(router): fix router.replace() navigation across nested navigators (#24457)
# Why
Fix ENG-10061
Fix https://github.com/expo/router/issues/793
Fix https://github.com/expo/router/issues/858
F
fix(router): fix router.replace() navigation across nested navigators (#24457)
# Why
Fix ENG-10061
Fix https://github.com/expo/router/issues/793
Fix https://github.com/expo/router/issues/858
Fix https://github.com/expo/router/issues/832
The `linkTo` function has two issues.
* It has trouble navigating to screens in different navigators with
identical names
* it cannot perform a replace navigation while in a nested navigator (it
can only replace at the currently level).
# How
The original plan was to change `linkTo` to do navigation by
deterministic keys, but React Navigation 7.0 is removing key based
navigation, so we'll keep with screen names.
This PR rewrites the `linkTo` function and simplifies the logic into two
paths.
**push**
`linkTo` will fire a dispatch action on the root navigator with the
desired state.
**replace**
We compare the current navigation state vs the desired state and find
the lowest common navigator that can perform a replace action. This
would be the `<Stack/>` or `<Tabs />` navigator that the two states
share in common. The common navigator (it could be the root navigator if
they have nothing in common!) is the source of the replace event
# Test Plan
Manually tested and wrote a new test.
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 46f023fa | 15-Sep-2023 |
Evan Bacon <[email protected]> |
[RFC] API Routes in Expo Router (#24429)
# Why
Servers are an important part of developing many different types of
apps, but they're much harder to configure than they need to be.
API Routes
[RFC] API Routes in Expo Router (#24429)
# Why
Servers are an important part of developing many different types of
apps, but they're much harder to configure than they need to be.
API Routes will enable users to express some abstract JavaScript code
that runs in a server by simply creating a file in the app directory,
and adding the `+api.js` suffix. For example, to securely interact with
OpenAI, simply:
```ts
// app/generate+api.ts
import { ExpoRequest, ExpoResponse } from 'expo-router/server';
export async function POST(req: ExpoRequest): Promise<ExpoResponse> {
const { prompt } = await req.json();
const json = await fetch('https://api.openai.com/v1/engines/text-davinci-003/completions', {
headers: {
'Content-Type': 'application/json',
// `OPENAI_API_KEY` is pulled from the .env file when running in Expo CLI.
Authorization: `Bearer ${process.env.OPENAI_API_KEY ?? ''}`,
},
method: 'POST',
body: JSON.stringify({
prompt,
max_tokens: 100,
}),
}).then(res => res.json());
// Return as JSON
return ExpoResponse.json(json);
}
```
This will be served at `http://localhost:8081/generate` with `npx expo`
and can be used by making a request:
```sh
$ curl -X POST -H "Content-Type: application/json" -d \'{"prompt":"Hello, my name is"}\' http://localhost:8081/generate
```
Expo Router polyfills the URL and `window.location` object on native to
allow for universally requesting with a relative URL:
```js
// Expo prepends the host and port to the URL automatically in development.
const json = await fetch('/generate').then(res => res.json());
```
# How
- API Routes are bundled with Metro, leveraging all the same
functionality as the rest of the app and website.
- The project babel config is used to transpile the API routes.
Indication is passed to the Babel caller via the `isServer` boolean.
This can be used to change the preset based on the environment.
- Each API route is bundled into a standalone file in the `dist/_expo`
directory. This is akin to ncc, the tool we use to make Create Expo App
download in ~1 second.
- Create a new package `@expo/server` which includes the requisite
middleware and runtime polyfills for the Expo server environment.
- Add a new routes manifest which will be used by `@expo/server` to
serve up the three types of routes: HTML routes, API routes, and not
found routes (404s).
- Add a new export `expo-router/server` (potentially will be moved to
`expo/server`) which contains the `ExpoRequest` and `ExpoResponse`
objects. These are all based on the WinterCG specification, and include
some additional properties for interop with the Expo Router filesystem
convention. These are inspired by Remix, SvelteKit, and Next.js for
simplicity.
- Add a new export mode `web.output: "server"` which can be used to
export a dynamic server. Note: I may drop this for now and make server
the default since there's no expo-specific hosting code that must be
exported.
- This PR adds the ability to host the app with an express server,
different production adapters to follow.
# Test Plan
In addition to all the E2E Metro tests, I've added a new E2E runner
which starts a server and pings different requests to ensure expected
behavior. These run in the CLI as opposed to the `@expo/server` package.
- resolve ENG-10057 ENG-8243 ENG-8082 ENG-8079 ENG-8242 ENG-8081
ENG-8080 ENG-9625
---------
Co-authored-by: Expo Bot <[email protected]>
Co-authored-by: Cedric van Putten <[email protected]>
show more ...
|
| 7c98c357 | 14-Sep-2023 |
Evan Bacon <[email protected]> |
feat(cli, router, metro, asset): add basePath support (#23911)
# Why
- Add the ability to export websites for hosting from a custom path.
This is required for GitHub pages.
- Resolve ENG-9193
feat(cli, router, metro, asset): add basePath support (#23911)
# Why
- Add the ability to export websites for hosting from a custom path.
This is required for GitHub pages.
- Resolve ENG-9193
- Resolve https://github.com/expo/expo/issues/20562
- Resolve https://github.com/expo/router/issues/165
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
- Add `expo.experiments.basePath` which can be used during `npx expo
export` to modify how assets are referenced.
- Set the `publicPath` in Metro to output as expected.
- Add custom asset writing for web to support stripping the unused
prefix.
- It's unclear if this should also apply to native, and if we should
have platform-specific variations.
- Update Expo Router to support automatically adjusting paths to support
basePath in production builds.
<!--
How did you build this feature or fix this bug and why?
-->
# Test Plan
- [ ] New `expo export` test.
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
Co-authored-by: Aman Mittal <[email protected]>
show more ...
|
| 80dc0679 | 11-Sep-2023 |
Mark Lawlor <[email protected]> |
fix(router): infinite renders when using nested boundaries (#24317)
# Why
https://github.com/expo/expo/pull/24185#issuecomment-1706964197
https://github.com/expo/expo/issues/24242
# How
Th
fix(router): infinite renders when using nested boundaries (#24317)
# Why
https://github.com/expo/expo/pull/24185#issuecomment-1706964197
https://github.com/expo/expo/issues/24242
# How
The qualified route component component loading is slightly unstable, as
it calls `fromLoadedRoute` every render. Normally this isn't an issue,
as routes typically return a stable component (the `default` export),
but when using an ErrorBoundary, this becomes non-stable.
# Test Plan
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 0ac667e5 | 11-Sep-2023 |
Evan Bacon <[email protected]> |
drop `react-native-gesture-handler` in router (#24314)
# Why
- The bundle size is too large to build a reasonable website with.
- Gestures are only required for drawer and other aspects of the a
drop `react-native-gesture-handler` in router (#24314)
# Why
- The bundle size is too large to build a reasonable website with.
- Gestures are only required for drawer and other aspects of the app,
but they aren't needed app-wide.
---------
Co-authored-by: Expo Bot <[email protected]>
Co-authored-by: Aman Mittal <[email protected]>
Co-authored-by: Bartosz Kaszubowski <[email protected]>
show more ...
|
| 4a8c0978 | 06-Sep-2023 |
Evan Bacon <[email protected]> |
chore: reduce unused web code (#24294)
# Why
Web bundles are too big by default, this is one of a series of PRs that
will reduce code that is pulled in on web.
<!--
Please describe the motiv
chore: reduce unused web code (#24294)
# Why
Web bundles are too big by default, this is one of a series of PRs that
will reduce code that is pulled in on web.
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
Because we compile the src of `@expo/metro-runtime` to CJS, the
`react-native-web` shaking plugin breaks and we import everything. This
PR also switches the input for `@expo/metro-runtime` to be `src` for
both web and native, while using `build` for Node.js and types.
<!--
How did you build this feature or fix this bug and why?
-->
# Test Plan
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| a51fdfe6 | 04-Sep-2023 |
Mark Lawlor <[email protected]> |
feat(router): remove expo-router 2.0 deprecations (#24219)
# Why
https://linear.app/expo/issue/ENG-9898/delete-deprecated-functions
# Test Plan
Manually created new example with tabs exampl
feat(router): remove expo-router 2.0 deprecations (#24219)
# Why
https://linear.app/expo/issue/ENG-9898/delete-deprecated-functions
# Test Plan
Manually created new example with tabs example.
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| fdcbdd08 | 04-Sep-2023 |
Mark Lawlor <[email protected]> |
fix(router): Drawer layout incorrect position on initial load (#24197)
# Why
https://github.com/expo/router/issues/837
ExpoRouter provides a `SafeAreaContextProvider` with an initial value of
fix(router): Drawer layout incorrect position on initial load (#24197)
# Why
https://github.com/expo/router/issues/837
ExpoRouter provides a `SafeAreaContextProvider` with an initial value of
`0` for all dimensions. The `drawer` layout uses these dimensions to
calculate the necessary x offset for its 'closed' state. These
calculations assume a minimum screen size, so having `0` caused it to
initially render on the screen
# How
We only need these initial values for static rendering, so now we only
provide them when rendering SSR.
# Test Plan
Tested manually by creating a new project.
# Checklist
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
show more ...
|
| 080145be | 01-Sep-2023 |
Evan Bacon <[email protected]> |
feat(router, metro-runtime): reduce production web code (#24215)
# Why
- Using the new source map support, I was able to identify and remove
some development-only code https://github.com/expo/ex
feat(router, metro-runtime): reduce production web code (#24215)
# Why
- Using the new source map support, I was able to identify and remove
some development-only code https://github.com/expo/expo/pull/24213/ --
over ~100kb smaller.
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
<!--
How did you build this feature or fix this bug and why?
-->
# Test Plan
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| ad7c940b | 30-Aug-2023 |
Mark Lawlor <[email protected]> |
feat(expo-router): upstream #861 - add listener types (#24174)
# Why
Upstream https://github.com/expo/router/pull/861
# Test Plan
: upstream #861 - add listener types (#24174)
# Why
Upstream https://github.com/expo/router/pull/861
# Test Plan

show more ...
|
| d57f6aa0 | 30-Aug-2023 |
Evan Bacon <[email protected]> |
fix(router): support push going back to sibling with nested stack from a modal. (#24166)
# Why
- Fix issue reported by @blainekasten.
- Increase logic in `push` to account for moving between sib
fix(router): support push going back to sibling with nested stack from a modal. (#24166)
# Why
- Fix issue reported by @blainekasten.
- Increase logic in `push` to account for moving between sibling routes
which all use the leaf-most name `index`.
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
- If the target route name is `index`, then use the parent state as the
route target. React Navigation would search for `index` when moving to
`slot/index` via `/slot`. This would result in the wrong route being
selected:
```
"routeNames": [
"index",
"slot",
"(group)",
"_sitemap",
"[...404]"
],
```
Now we account for index routes by pushing up to `slot` so the
`StackRouter` can identify the right screen.
# Test Plan
- The issue could be reproduced using our testing library.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 7251daf2 | 30-Aug-2023 |
Anthony Mittaz <[email protected]> |
[router] Fix false positive redirect deprecation since version 2.0.1 when using Screen (#23932)
# Why
WARN The redirect prop on <Screen /> is deprecated and will be removed.
Please use router.re
[router] Fix false positive redirect deprecation since version 2.0.1 when using Screen (#23932)
# Why
WARN The redirect prop on <Screen /> is deprecated and will be removed.
Please use router.redirect, fixes
https://github.com/expo/router/issues/834
I think issue is here perhaps
https://github.com/expo/router/blob/f69e31c84a83ceb6d678dfb8aeed708974d301a8/packages/expo-router/src/views/Screen.tsx#L49
if you look at the code, if you do this for example:
```
<Stack.Screen
options={{
title: params.name,
}}
/>
```
Then deprecated prop would end up being `undefined` because `redirect` would not be set
```
useDeprecated(
"The `redirect` prop on <Screen /> is deprecated and will be removed.
Please use `router.redirect` instead",
redirect
);
```
Then looking at `useDepecated` code here:
```
export function useDeprecated(
message: string,
guard: unknown = true,
key = message
) {
return useWarnOnce(key, guard, `Expo Router: ${message}`);
}
```
the `guard` would end up being set to `true` because of the default value `guard: unknown = true`
# How
Avoid sending an undefined `redirect` prop to the guard
# Test Plan
Run updated code and make sure warning is gone
# Checklist
<!--
Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules.
-->
- [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
---------
Co-authored-by: Evan Bacon <[email protected]>
Co-authored-by: Lucas Caton <[email protected]>
show more ...
|
| be7b8fb5 | 29-Aug-2023 |
Evan Bacon <[email protected]> |
fix(router): Use deeper clone to prevent state leak. (#24149)
# Why
- Use a full serial clone to prevent any state leaking. This is a more
thorough implementation of #24147
- No test case for t
fix(router): Use deeper clone to prevent state leak. (#24149)
# Why
- Use a full serial clone to prevent any state leaking. This is a more
thorough implementation of #24147
- No test case for this at the moment but it should scale better. May
come back and make a faster version later.
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
<!--
How did you build this feature or fix this bug and why?
-->
# Test Plan
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| cea96f55 | 28-Aug-2023 |
Evan Bacon <[email protected]> |
fix: prevent double renders when pushing stacks. (#24147)
# Why
Prevent double renders by cloning state to avoid leaking state between
functions.
- fix https://github.com/expo/router/issues/8
fix: prevent double renders when pushing stacks. (#24147)
# Why
Prevent double renders by cloning state to avoid leaking state between
functions.
- fix https://github.com/expo/router/issues/838
- fix https://github.com/expo/router/pull/733
- fix https://github.com/expo/router/issues/320
- The issue https://github.com/expo/router/issues/320 has multiple
different things linked, but the original case appears to be fixed.
- possibly also addresses https://github.com/expo/router/issues/847
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
- Prevent mutating the input state to avoid invalidating the nested
state.
# Test Plan
- The testing library doesn't seem to support this case. @marklawlor has
been tasked with ensuring the original branch can detect the error
https://github.com/expo/expo/compare/%40evanbacon/router/fix-838
Just in case the testing library isn't fixed, I ran locally with:
- `app/_layout.js`, `app/(a)/_layout.js`, `app/b/_layout.js`
```js
import { Slot } from "expo-router";
export default function RootLayout() {
return <Slot />
}
```
- `app/(a)/index.js`
```js
import { router, useNavigation } from "expo-router";
import { View } from "react-native";
export default function App() {
// const navigation = useNavigation();
setTimeout(() => {
router.push("/b");
// navigation.push("b");
});
return (
<View />
);
}
```
- `app/b/index.js`
```js
import { usePathname } from 'expo-router';
import { Text, View } from 'react-native';
let i = 0;
export default function Page() {
const path = usePathname();
i++;
return (
<View style={{ flex: 1, backgroundColor: i > 1 ? "red" : "white" }}>
<Text>Path: {path}</Text>
</View>
);
}
```
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| eb6aeb3b | 23-Aug-2023 |
Evan Bacon <[email protected]> |
Patch `react-native-web` AppContainer to prevent adding extra divs. (#24093)
# Why
`react-native-web` wraps the root with two extra Views, not only is this
bloat but it breaks how we static rend
Patch `react-native-web` AppContainer to prevent adding extra divs. (#24093)
# Why
`react-native-web` wraps the root with two extra Views, not only is this
bloat but it breaks how we static render because we pass the root +html
(`<html>`) to the static rendering system. If you pass
`<div><html><body></body></html></div>` to a browser, it will be broken.
This PR simply patches the metro resolution to use a basic in-out
function when react-native-web attempts to wrap the root.
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# Test Plan
- E2E metro should pass.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 72b417e4 | 23-Aug-2023 |
Evan Bacon <[email protected]> |
fix(router): Fix error overlay not being applied on web (#24052)
# Why
- regression in #23891.
- fix static rehydration.
- fix react refresh for web in the monorepo.
- fix react-native-web war
fix(router): Fix error overlay not being applied on web (#24052)
# Why
- regression in #23891.
- fix static rehydration.
- fix react refresh for web in the monorepo.
- fix react-native-web warnings.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 557aaacd | 21-Aug-2023 |
Evan Bacon <[email protected]> |
feat(font): add static optimization for fonts in expo router (#24027)
# Why
Extract fonts loaded with expo-font when using Expo Router on with
server rendering on web. This ensures that fonts ar
feat(font): add static optimization for fonts in expo router (#24027)
# Why
Extract fonts loaded with expo-font when using Expo Router on with
server rendering on web. This ensures that fonts are available before
the JavaScript loads, leading to much better UI during the initial
render.
Consider the following snippet:
```js
import FontAwesome from "@expo/vector-icons/FontAwesome";
import * as Font from "expo-font";
import { Text } from "react-native";
export default function Layout() {
// These fonts will be statically extracted on web and added to the initial HTML.
const [loaded, error] = Font.useFonts({
...FontAwesome.font,
Inter_400Regular: require("@/assets/fonts/Inter_400Regular.ttf"),
Inter_500Medium: require("@/assets/fonts/Inter_500Medium.ttf"),
});
if (loaded) {
// This code-path will never be used in static rendering now.
return null;
}
// This font is now styled before the JavaScript loads.
return (
<Text style={{ fontFamily: 'Inter_400Regular' }}>Hey</Text>
);
}
```
> Native can continue to be written defensively, web will adapt to the
API.
https://github.com/expo/expo/assets/9664363/e03de783-bcee-49d3-9bca-15bfc87966d5
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
- When `loadAsync` or `useFonts` is used during static rendering, the
font will be added to a shared server context, which is then pulled in
`expo-router` and added to the static HTML. This doesn't work if the
call is outside the React tree, or if the font is loaded asynchronously,
or if the font is loaded in a `useEffect`.
- Updated docs to reflect new system.
# Test Plan
- E2E bundling test.
- Ensure that `useFonts` doesn't return `false` on the first render,
this prevents returning `null` and rendering nothing actionable.
- Ensure fonts are linked and preloaded according to the routes that
load them, including nesting.
- Node unit test to reduce the chance of breaking the more fragile parts
of the API.
- Published in a test app:
[before](https://64e0e449c07fa060ba0ce443--pillarvalley.netlify.app/settings/)
[after](https://64e0fb6251f1396c0b3eb62f--pillarvalley.netlify.app/settings/).
Notice that disabling JavaScript doesn't break font loading.
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
Co-authored-by: Aman Mittal <[email protected]>
show more ...
|
| 475a49ae | 15-Aug-2023 |
Evan Bacon <[email protected]> |
fix(router): prevent throwing in canGoBack when the navigation hasn't mounted (#23959)
# Why
- fix https://github.com/expo/router/pull/839, resolve for RBI
- The `canGoBack` method should be sma
fix(router): prevent throwing in canGoBack when the navigation hasn't mounted (#23959)
# Why
- fix https://github.com/expo/router/pull/839, resolve for RBI
- The `canGoBack` method should be smarter and prevent throwing if the
navigation hasn't mounted yet.
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# Test Plan
- Added unit test for this functionality. Could repro before the fix.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 8a424beb | 11-Aug-2023 |
James Ide <[email protected]> |
[lint] Upgrade to Prettier v3, typescript-eslint to v6 (#23544)
Why
---
Prettier 3 is out. Add support for it with this linter config.
**Note for reviewer:** the first commit is the one with th
[lint] Upgrade to Prettier v3, typescript-eslint to v6 (#23544)
Why
---
Prettier 3 is out. Add support for it with this linter config.
**Note for reviewer:** the first commit is the one with the actual
changes. The rest of this PR are changes to get the linter passing
(mostly autofix).
How
---
Update eslint-config-prettier and eslint-plugin-prettier. To address
deprecation warnings, also update typescript-eslint/parser and
typescript-eslint/eslint-plugin.
Because of an update to typescript-eslint/parser, we need to suppress
deprecation warnings (documented in a comment).
Regenerated test snapshots. Due to the upgraded dependencies, typecasts
and optional chaining are now auto-fixable by lint. This converts
warnings into autofixes.
Test Plan
---
`yarn test` in the linter config. Run `expotools check --all --fix-lint
--no-build --no-test --no-uniformity-check` to try this config on the
whole repo.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| a3696c29 | 10-Aug-2023 |
Evan Bacon <[email protected]> |
chore(router)!: pull out @bacons/react-views (#23889)
# Why
- Resolve ENG-9691
- Most of the benefits should be folded back in to Expo upstream.
- Simplify the codebase.
---------
Co-auth
chore(router)!: pull out @bacons/react-views (#23889)
# Why
- Resolve ENG-9691
- Most of the benefits should be folded back in to Expo upstream.
- Simplify the codebase.
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|
| 7d43433c | 10-Aug-2023 |
Evan Bacon <[email protected]> |
feat(router): Move entry registration to `expo`. (#23891)
# Why
- We forked away from the `expo` entry registration in `expo-router` v2
in order to support static rendering on web.
- We can "un
feat(router): Move entry registration to `expo`. (#23891)
# Why
- We forked away from the `expo` entry registration in `expo-router` v2
in order to support static rendering on web.
- We can "unfork" this function and move the static support upstream as
of SDK 49.
- Resolve ENG-9697
<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->
# How
<!--
How did you build this feature or fix this bug and why?
-->
# Test Plan
<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->
- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
---------
Co-authored-by: Expo Bot <[email protected]>
show more ...
|