Skip to content

Commit 9766fe6

Browse files
Kyle Rosenbergnecolas
authored andcommitted
[fix] Export useLocaleContext as default export
Close #2389
1 parent c764f96 commit 9766fe6

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ export { default as unstable_createElement } from 'react-native-web/dist/exports
3030
3131
`;
3232

33-
exports[`Rewrite react-native to react-native-web import from "native-native": import from "native-native" 1`] = `
33+
exports[`Rewrite react-native to react-native-web import from "react-native": import from "react-native" 1`] = `
3434
3535
import ReactNative from 'react-native';
3636
import { View } from 'react-native';
3737
import { Invalid, View as MyView } from 'react-native';
38+
import { useLocaleContext } from 'react-native';
3839
import * as ReactNativeModules from 'react-native';
3940
4041
↓ ↓ ↓ ↓ ↓ ↓
@@ -43,12 +44,13 @@ import ReactNative from 'react-native-web/dist/index';
4344
import View from 'react-native-web/dist/exports/View';
4445
import { Invalid } from 'react-native-web/dist/index';
4546
import MyView from 'react-native-web/dist/exports/View';
47+
import useLocaleContext from 'react-native-web/dist/exports/useLocaleContext';
4648
import * as ReactNativeModules from 'react-native-web/dist/index';
4749
4850
4951
`;
5052

51-
exports[`Rewrite react-native to react-native-web import from "native-native": import from "native-native" 2`] = `
53+
exports[`Rewrite react-native to react-native-web import from "react-native": import from "react-native" 2`] = `
5254
5355
import ReactNative from 'react-native';
5456
import { View } from 'react-native';

packages/babel-plugin-react-native-web/src/__tests__/index-test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ const pluginTester = require('babel-plugin-tester').default;
44
const tests = [
55
// import react-native
66
{
7-
title: 'import from "native-native"',
7+
title: 'import from "react-native"',
88
code: `import ReactNative from 'react-native';
99
import { View } from 'react-native';
1010
import { Invalid, View as MyView } from 'react-native';
11+
import { useLocaleContext } from 'react-native';
1112
import * as ReactNativeModules from 'react-native';`,
1213
snapshot: true
1314
},
1415
{
15-
title: 'import from "native-native"',
16+
title: 'import from "react-native"',
1617
code: `import ReactNative from 'react-native';
1718
import { View } from 'react-native';
1819
import { Invalid, View as MyView } from 'react-native';
@@ -39,6 +40,7 @@ export { StyleSheet, Text, unstable_createElement } from 'react-native';`,
3940
export { StyleSheet, Text, unstable_createElement } from 'react-native-web';`,
4041
snapshot: true
4142
},
43+
// require react-native
4244
{
4345
title: 'require "react-native"',
4446
code: `const ReactNative = require('react-native');

packages/react-native-web/src/exports/useLocaleContext/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
* @flow strict
88
*/
99

10-
export { useLocaleContext } from '../../modules/useLocale';
10+
import { useLocaleContext } from '../../modules/useLocale';
11+
export default useLocaleContext;

packages/react-native-web/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ export { default as DeviceEventEmitter } from './exports/DeviceEventEmitter';
7777

7878
// hooks
7979
export { default as useColorScheme } from './exports/useColorScheme';
80-
export { useLocaleContext } from './exports/useLocaleContext';
80+
export { default as useLocaleContext } from './exports/useLocaleContext';
8181
export { default as useWindowDimensions } from './exports/useWindowDimensions';

0 commit comments

Comments
 (0)