mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-12 02:55:52 +00:00
committed by
Nicolas Gallagher
parent
c764f96ef4
commit
9766fe6d4b
@@ -30,11 +30,12 @@ export { default as unstable_createElement } from 'react-native-web/dist/exports
|
||||
|
||||
`;
|
||||
|
||||
exports[`Rewrite react-native to react-native-web import from "native-native": import from "native-native" 1`] = `
|
||||
exports[`Rewrite react-native to react-native-web import from "react-native": import from "react-native" 1`] = `
|
||||
|
||||
import ReactNative from 'react-native';
|
||||
import { View } from 'react-native';
|
||||
import { Invalid, View as MyView } from 'react-native';
|
||||
import { useLocaleContext } from 'react-native';
|
||||
import * as ReactNativeModules from 'react-native';
|
||||
|
||||
↓ ↓ ↓ ↓ ↓ ↓
|
||||
@@ -43,12 +44,13 @@ import ReactNative from 'react-native-web/dist/index';
|
||||
import View from 'react-native-web/dist/exports/View';
|
||||
import { Invalid } from 'react-native-web/dist/index';
|
||||
import MyView from 'react-native-web/dist/exports/View';
|
||||
import useLocaleContext from 'react-native-web/dist/exports/useLocaleContext';
|
||||
import * as ReactNativeModules from 'react-native-web/dist/index';
|
||||
|
||||
|
||||
`;
|
||||
|
||||
exports[`Rewrite react-native to react-native-web import from "native-native": import from "native-native" 2`] = `
|
||||
exports[`Rewrite react-native to react-native-web import from "react-native": import from "react-native" 2`] = `
|
||||
|
||||
import ReactNative from 'react-native';
|
||||
import { View } from 'react-native';
|
||||
|
||||
@@ -4,15 +4,16 @@ const pluginTester = require('babel-plugin-tester').default;
|
||||
const tests = [
|
||||
// import react-native
|
||||
{
|
||||
title: 'import from "native-native"',
|
||||
title: 'import from "react-native"',
|
||||
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 * as ReactNativeModules from 'react-native';`,
|
||||
snapshot: true
|
||||
},
|
||||
{
|
||||
title: 'import from "native-native"',
|
||||
title: 'import from "react-native"',
|
||||
code: `import ReactNative from 'react-native';
|
||||
import { View } from 'react-native';
|
||||
import { Invalid, View as MyView } from 'react-native';
|
||||
@@ -39,6 +40,7 @@ export { StyleSheet, Text, unstable_createElement } from 'react-native';`,
|
||||
export { StyleSheet, Text, unstable_createElement } from 'react-native-web';`,
|
||||
snapshot: true
|
||||
},
|
||||
// require react-native
|
||||
{
|
||||
title: 'require "react-native"',
|
||||
code: `const ReactNative = require('react-native');
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
export { useLocaleContext } from '../../modules/useLocale';
|
||||
import { useLocaleContext } from '../../modules/useLocale';
|
||||
export default useLocaleContext;
|
||||
|
||||
2
packages/react-native-web/src/index.js
vendored
2
packages/react-native-web/src/index.js
vendored
@@ -77,5 +77,5 @@ export { default as DeviceEventEmitter } from './exports/DeviceEventEmitter';
|
||||
|
||||
// hooks
|
||||
export { default as useColorScheme } from './exports/useColorScheme';
|
||||
export { useLocaleContext } from './exports/useLocaleContext';
|
||||
export { default as useLocaleContext } from './exports/useLocaleContext';
|
||||
export { default as useWindowDimensions } from './exports/useWindowDimensions';
|
||||
|
||||
Reference in New Issue
Block a user