diff --git a/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap b/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap index b7616ce705..126b17dd84 100644 --- a/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap +++ b/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap @@ -5,7 +5,7 @@ exports[`Rewrite react-native to react-native-web > 1. import from "react-native import ReactNative from 'react-native'; import { View } from 'react-native'; import { Invalid, View as MyView } from 'react-native'; -import { useLocaleContext } from 'react-native'; +import { useColorScheme } from 'react-native'; import * as ReactNativeModules from 'react-native'; ↓ ↓ ↓ ↓ ↓ ↓ @@ -14,7 +14,7 @@ import ReactNative from "react-native-web/dist/index.js"; import View from "react-native-web/dist/exports/View"; import { Invalid } from "react-native-web/dist/index.js"; import MyView from "react-native-web/dist/exports/View"; -import useLocaleContext from "react-native-web/dist/exports/useLocaleContext"; +import useColorScheme from "react-native-web/dist/exports/useColorScheme"; import * as ReactNativeModules from "react-native-web/dist/index.js"; `; diff --git a/packages/babel-plugin-react-native-web/src/__tests__/index-test.js b/packages/babel-plugin-react-native-web/src/__tests__/index-test.js index bbf6958591..24373b674b 100644 --- a/packages/babel-plugin-react-native-web/src/__tests__/index-test.js +++ b/packages/babel-plugin-react-native-web/src/__tests__/index-test.js @@ -8,7 +8,7 @@ const tests = [ code: `import ReactNative from 'react-native'; import { View } from 'react-native'; import { Invalid, View as MyView } from 'react-native'; -import { useLocaleContext } from 'react-native'; +import { useColorScheme } from 'react-native'; import * as ReactNativeModules from 'react-native';`, snapshot: true }, diff --git a/packages/babel-plugin-react-native-web/src/moduleMap.js b/packages/babel-plugin-react-native-web/src/moduleMap.js index 57a8c1f5e3..90801b2525 100644 --- a/packages/babel-plugin-react-native-web/src/moduleMap.js +++ b/packages/babel-plugin-react-native-web/src/moduleMap.js @@ -59,6 +59,5 @@ module.exports = { useAnimatedValue: true, useAnimatedValueXY: true, useColorScheme: true, - useLocaleContext: true, useWindowDimensions: true }; diff --git a/packages/react-native-web-docs/src/pages/docs/appendix/unstable-apis.md b/packages/react-native-web-docs/src/pages/docs/appendix/unstable-apis.md index c005e963f2..450cd18ee4 100644 --- a/packages/react-native-web-docs/src/pages/docs/appendix/unstable-apis.md +++ b/packages/react-native-web-docs/src/pages/docs/appendix/unstable-apis.md @@ -17,6 +17,12 @@ The following APIs are unstable and subject to breaking changes. Use at your own React Native for Web exports a web-specific module called `unstable_createElement`, which can be used to wrap React DOM components. This allows you to use React Native's accessibility and style optimizations. Since this is a web-specific export it should always be imported from the `react-native-web` package. +It has the same signature as `React.createElement`: + +```js +unstable_createElement(component, props, ...children); +``` + In the example below, `Video` will now accept common React Native props such as `aria-label`, `accessible`, `style`, and even the Responder event props. ```js @@ -29,17 +35,13 @@ This also works with composite components defined in your existing component gal ```js import RaisedButton from 'material-ui/RaisedButton'; import { StyleSheet } from 'react-native'; -import { unstable_createElement, useLocaleContext } from 'react-native-web'; - -const CustomButton = (props) => { - const { direction } = useLocaleContext(); +import { unstable_createElement } from 'react-native-web'; - return unstable_createElement( - RaisedButton, - { ...props, style: [styles.button, props.style] }, - { writingDirection: direction } - ); -}; +const CustomButton = (props) => + unstable_createElement(RaisedButton, { + ...props, + style: [styles.button, props.style] + }); const styles = StyleSheet.create({ button: { diff --git a/packages/react-native-web-docs/src/pages/docs/components/text-input.md b/packages/react-native-web-docs/src/pages/docs/components/text-input.md index 7c64eafc23..ae3b56cecc 100644 --- a/packages/react-native-web-docs/src/pages/docs/components/text-input.md +++ b/packages/react-native-web-docs/src/pages/docs/components/text-input.md @@ -76,10 +76,6 @@ Equivalent to [HTMLElement.dataset](https://developer.mozilla.org/en-US/docs/Web The initial value of the input. Useful for simple use-cases where you don't want to deal with listening to events and updating the value prop to keep the controlled state in sync. {% endcall %} -{% call macro.prop('dir', '?("auto" | "ltr" | "rtl") = "auto"') %} -Equivalent to [HTMLElement.dir](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dir). -{% endcall %} - {% call macro.prop('disabled', '?boolean = false') %} Equivalent to [HTMLElement.disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled) {% endcall %} @@ -96,10 +92,6 @@ Equivalent to [HTMLElement.id](https://developer.mozilla.org/en-US/docs/Web/HTML Hints at the type of data that might be entered by the user while editing the element or its contents. Equivalent to [HTMLElement.inputMode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode). Safari iOS requires an ancestral `