mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 04:45:19 +08:00
refactor: rename NativeContainer -> NavigationNativeContainer
This commit is contained in:
@@ -8,7 +8,10 @@ import {
|
||||
getStateFromPath,
|
||||
NavigationContainerRef,
|
||||
} from '@react-navigation/core';
|
||||
import { useLinking, NativeContainer } from '@react-navigation/native';
|
||||
import {
|
||||
useLinking,
|
||||
NavigationNativeContainer,
|
||||
} from '@react-navigation/native';
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
DrawerNavigationProp,
|
||||
@@ -118,7 +121,7 @@ export default function App() {
|
||||
}
|
||||
|
||||
return (
|
||||
<NativeContainer
|
||||
<NavigationNativeContainer
|
||||
ref={containerRef}
|
||||
initialState={initialState}
|
||||
onStateChange={state =>
|
||||
@@ -177,6 +180,6 @@ export default function App() {
|
||||
)}
|
||||
</Drawer.Screen>
|
||||
</Drawer.Navigator>
|
||||
</NativeContainer>
|
||||
</NavigationNativeContainer>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ import useBackButton from './useBackButton';
|
||||
* @param props.children Child elements to render the content.
|
||||
* @param props.ref Ref object which refers to the navigation object containing helper methods.
|
||||
*/
|
||||
|
||||
const NativeContainer = React.forwardRef(function NativeContainer(
|
||||
const NavigationNativeContainer = React.forwardRef(function NativeContainer(
|
||||
props: NavigationContainerProps,
|
||||
ref: React.Ref<NavigationContainerRef>
|
||||
) {
|
||||
const refContainer = React.useRef<NavigationContainerRef>(null);
|
||||
|
||||
useBackButton(refContainer);
|
||||
|
||||
React.useImperativeHandle(ref, () => refContainer.current);
|
||||
|
||||
return (
|
||||
@@ -35,4 +35,4 @@ const NativeContainer = React.forwardRef(function NativeContainer(
|
||||
);
|
||||
});
|
||||
|
||||
export default NativeContainer;
|
||||
export default NavigationNativeContainer;
|
||||
@@ -1,4 +1,7 @@
|
||||
export { default as NativeContainer } from './NativeContainer';
|
||||
export {
|
||||
default as NavigationNativeContainer,
|
||||
} from './NavigationNativeContainer';
|
||||
|
||||
export { default as useBackButton } from './useBackButton';
|
||||
export { default as useLinking } from './useLinking';
|
||||
export { default as useScrollToTop } from './useScrollToTop';
|
||||
|
||||
Reference in New Issue
Block a user