diff --git a/packages/docs/src/pages/docs/components/react-root-view.md b/packages/docs/src/pages/docs/components/react-root-view.md new file mode 100644 index 0000000000..3ec6284f1b --- /dev/null +++ b/packages/docs/src/pages/docs/components/react-root-view.md @@ -0,0 +1,35 @@ +--- +title: ReactRootView +date: Last Modified +permalink: /docs/react-root-view/index.html +eleventyNavigation: + key: ReactRootView + parent: Components +--- + +{% import "fragments/macros.html" as macro with context %} + +:::lead +Root view component react-native-web app. This components manages HTML content of the window (css styles, root componet, event handling). By default this component is create in the AppRegistry, but you can use it if you want to render the react content into different native window. +::: + +```jsx +import { ImageBackground } from 'react-native'; + +{children}; +``` + +--- + +## API + +### Props + +{% call macro.prop('children', '?any') %} +The children of a View element can be other elements and must not include strings (or components that render down to strings). +{% endcall %} + +{% call macro.prop('rootTag', '?HTMLElement') %} +The native element where the ReactRootView will be shown. +{% endcall %} + diff --git a/packages/examples/pages/_app.js b/packages/examples/pages/_app.js new file mode 100644 index 0000000000..d3b7d894a2 --- /dev/null +++ b/packages/examples/pages/_app.js @@ -0,0 +1,6 @@ +import * as React from 'react'; +import { ReactRootView } from 'react-native-web'; + +export default function Application({ Component, pageProps }) { + return {}; +} diff --git a/packages/examples/pages/multi-window/index.js b/packages/examples/pages/multi-window/index.js new file mode 100644 index 0000000000..d273b6a65c --- /dev/null +++ b/packages/examples/pages/multi-window/index.js @@ -0,0 +1,80 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Button, StyleSheet, Text, View, ReactRootView } from 'react-native'; + +import Example from '../../shared/example'; + +export function ChildWindowPage() { + const [clicked, setClicked] = React.useState(false); + + function onClick() { + setClicked(true); + } + + return ( + +