Package Exports
- @expo/next-adapter
- @expo/next-adapter/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@expo/next-adapter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
👋 Welcome to
@expo/next-adapter
The document component for Next.js projects using Unimodules
🏁 Setup
Install @expo/next-adapter in your project.
yarn add @expo/next-adapter⚽️ Usage
Re-export this component from the pages/_document.js file of your Next.js project.
// pages/_document.js
import { Document } from '@expo/next-adapter';
export default Document;Customizing the Document
You can import the following fragments from the custom Document:
import { Document, getInitialProps, style } from '@expo/next-adapter';Then recompose the Document how you like
import { getInitialProps } from '@expo/next-adapter';
import Document, { Head, Main, NextScript } from 'next/document';
import React from 'react';
class CustomDocument extends Document {
render() {
return (
<html>
<Head>
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
}
// Import the getInitialProps method and assign it to your component
CustomDocument.getInitialProps = getInitialProps;
// OR...
CustomDocument.getInitialProps = async props => {
const result = await getInitialProps(props);
// Mutate result...
return result;
};
export default CustomDocument;License
The Expo source code is made available under the MIT license. Some of the dependencies are licensed differently, with the BSD license, for example.