Closed nandorojo closed 2 years ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
solito | ✅ Ready (Inspect) | Visit Preview | Nov 25, 2022 at 4:35PM (UTC) |
solito-s9oj | ❌ Failed (Inspect) | Nov 25, 2022 at 4:35PM (UTC) | |
with-custom-fonts | ✅ Ready (Inspect) | Visit Preview | Nov 25, 2022 at 4:35PM (UTC) |
Did you experiment with the app folder ? I try to reproduce the document initialprops in the RootLayout but no luck, keeping the _document file doest work either.
Also expo next adapter just upgrate to support next13 take a look: https://github.com/expo/expo-cli/tree/main/packages/next-adapter#readme
submitted PR #230 to fix error on expo due to updated nextjs useRouter hook.
Did you experiment with the app folder ? I try to reproduce the document initialprops in the RootLayout but no luck, keeping the _document file doest work either.
Not yet. This will require a new approach to injecting styles and such, without _document
.
If you want to try, see this: https://beta.nextjs.org/docs/styling/css-in-js
I'm not sure if react-native-web supports this or not.
I think we'd need to add this to the root layout:
import { useServerInsertedHTML } from 'next/navigation';
import { AppRegistry } from 'react-native'
// ...
useServerInsertedHTML(() => {
// where does Main come from in Next 13?
AppRegistry.registerComponent('Main', () => Main)
// @ts-ignore
const { getStyleElement } = AppRegistry.getApplication('Main')
return <>{getStyleElement()}</>;
});
Did you experiment with the app folder ? I try to reproduce the document initialprops in the RootLayout but no luck, keeping the _document file doest work either.
Not yet. This will require a new approach to injecting styles and such, without
_document
.If you want to try, see this: https://beta.nextjs.org/docs/styling/css-in-js
I'm not sure if react-native-web supports this or not.
I think we'd need to add this to the root layout:
import { useServerInsertedHTML } from 'next/navigation'; import { AppRegistry } from 'react-native' // ... useServerInsertedHTML(() => { // where does Main come from in Next 13? AppRegistry.registerComponent('Main', () => Main) // @ts-ignore const { getStyleElement } = AppRegistry.getApplication('Main') return <>{getStyleElement()}</>; });
did you found a solution for that?
Any updates on this
Sigh, random pings.
I opened a PR at #397 to add app directory support. Maybe one of you can help figure out how to get useServerInsertedHTML
to work with React Native.
@nandorojo check the tamagui starter app https://github.com/tamagui/tamagui/blob/master/starters/next-expo-solito/apps/next/app/TamaguiProvider.tsx
interesting...does Main
still work here? may as well try 🤷♂️
Wow, can't believe I got this working lol.
@nandorojo Woot! 🎉
interesting...does
Main
still work here? may as well try 🤷♂️
I think Main
actually does nothing here and the registerComponent
function only is only called to trigger the generation of the RN CSS so you can fetch it using getStyleElement
, pretty sure if you pass it an empty component it will still work. Also, I think this might be unperformant as it would register the app on each re-render.
Can you try this instead and see if it works? Follows roughly what's in the next.js docs here
const [reactNativeApp] = useState(() => {
AppRegistry.registerComponent('Main', () => () => null);
// @ts-ignore
return AppRegistry.getApplication('Main');
});
useServerInsertedHTML(() => reactNativeApp.getStyleElement());
@nandorojo Woot! 🎉
interesting...does
Main
still work here? may as well try 🤷♂️I think
Main
actually does nothing here and theregisterComponent
function only is only called to trigger the generation of the RN CSS so you can fetch it usinggetStyleElement
, pretty sure if you pass it an empty component it will still work. Also, I think this might be unperformant as it would register the app on each re-render.Can you try this instead and see if it works? Follows roughly what's in the next.js docs here
const [reactNativeApp] = useState(() => { AppRegistry.registerComponent('Main', () => () => null); // @ts-ignore return AppRegistry.getApplication('Main'); }); useServerInsertedHTML(() => reactNativeApp.getStyleElement());
Actually yes, Im not even using the app registry and it works normally, just needs to import the .css with RNW reset.
To try this:
Closes #202