Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type NativeScreenProps = Omit<
sheetLargestUndimmedDetent: number;
};

export const NativeScreen: React.ComponentType<NativeScreenProps> =
const NativeScreen: React.ComponentType<NativeScreenProps> =
ScreenNativeComponent as React.ComponentType<NativeScreenProps>;
const AnimatedNativeScreen = Animated.createAnimatedComponent(NativeScreen);
const AnimatedNativeModalScreen = Animated.createAnimatedComponent(
Expand Down
13 changes: 3 additions & 10 deletions src/components/ScreenContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,18 @@ import { isNativePlatformSupported, screensEnabled } from '../core';
import ScreenContainerNativeComponent from '../fabric/ScreenContainerNativeComponent';
import ScreenNavigationContainerNativeComponent from '../fabric/ScreenNavigationContainerNativeComponent';

export const NativeScreenContainer: React.ComponentType<ScreenContainerProps> =
Platform.OS !== 'web' ? (ScreenContainerNativeComponent as any) : View;
export const NativeScreenNavigationContainer: React.ComponentType<ScreenContainerProps> =
Platform.OS !== 'web'
? (ScreenNavigationContainerNativeComponent as any)
: View;

function ScreenContainer(props: ScreenContainerProps) {
const { enabled = screensEnabled(), hasTwoStates, ...rest } = props;

if (enabled && isNativePlatformSupported) {
if (hasTwoStates) {
const ScreenNavigationContainer =
Platform.OS === 'ios'
? NativeScreenNavigationContainer
: NativeScreenContainer;
? ScreenNavigationContainerNativeComponent
: ScreenContainerNativeComponent;
return <ScreenNavigationContainer {...rest} />;
}
return <NativeScreenContainer {...rest} />;
return <ScreenContainerNativeComponent {...rest} />;
}
return <View {...rest} />;
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/ScreenContainer.web.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { View } from 'react-native';

export const NativeScreenContainer = View;
export const NativeScreenNavigationContainer = View;
const ScreenContainer = View;

export default View;
export default ScreenContainer;
7 changes: 2 additions & 5 deletions src/components/ScreenContentWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React from 'react';
import { Platform, View, ViewProps } from 'react-native';
import { ViewProps } from 'react-native';
import ScreenContentWrapperNativeComponent from '../fabric/ScreenContentWrapperNativeComponent';

export const NativeScreenContentWrapper: React.ComponentType<ViewProps> =
Platform.OS !== 'web' ? (ScreenContentWrapperNativeComponent as any) : View;

function ScreenContentWrapper(props: ViewProps) {
return <NativeScreenContentWrapper collapsable={false} {...props} />;
return <ScreenContentWrapperNativeComponent collapsable={false} {...props} />;
}

export default ScreenContentWrapper;
3 changes: 1 addition & 2 deletions src/components/ScreenContentWrapper.web.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { View } from 'react-native';

export const NativeScreenContentWrapper = View;

const ScreenContentWrapper = View;

export default ScreenContentWrapper;
10 changes: 2 additions & 8 deletions src/components/ScreenFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import React from 'react';
import { Platform, View, ViewProps } from 'react-native';
import { ViewProps } from 'react-native';
import ScreenFooterNativeComponent from '../fabric/ScreenFooterNativeComponent';

/**
* Unstable API
*/
export const NativeScreenFooter: React.ComponentType<ViewProps> =
Platform.OS !== 'web' ? (ScreenFooterNativeComponent as any) : View;

/**
* Unstable API
*/
function ScreenFooter(props: ViewProps) {
return <NativeScreenFooter {...props} />;
return <ScreenFooterNativeComponent {...props} />;
}

export default ScreenFooter;
3 changes: 1 addition & 2 deletions src/components/ScreenFooter.web.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { View } from 'react-native';

export const NativeScreenFooter = View;

const ScreenFooter = View;

export default ScreenFooter;
4 changes: 3 additions & 1 deletion src/components/ScreenStack.web.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { View } from 'react-native';

export default View;
const ScreenStack = View;

export default ScreenStack;
4 changes: 2 additions & 2 deletions src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import SearchBarNativeComponent, {
} from '../fabric/SearchBarNativeComponent';
import { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';

export const NativeSearchBar: React.ComponentType<
const NativeSearchBar: React.ComponentType<
SearchBarNativeProps & { ref?: React.RefObject<SearchBarCommands> }
> &
typeof NativeSearchBarCommands =
SearchBarNativeComponent as unknown as React.ComponentType<SearchBarNativeProps> &
SearchBarCommandsType;
export const NativeSearchBarCommands: SearchBarCommandsType =
const NativeSearchBarCommands: SearchBarCommandsType =
SearchBarNativeCommands as SearchBarCommandsType;

type NativeSearchBarRef = React.ElementRef<typeof NativeSearchBar>;
Expand Down
5 changes: 2 additions & 3 deletions src/components/SearchBar.web.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { View } from 'react-native';

export const NativeSearchBar = View;
export const NativeSearchBarCommands = View;
const SearchBar = View;

export default View;
export default SearchBar;
35 changes: 5 additions & 30 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,10 @@ export {
*/
export {
default as Screen,
NativeScreen,
InnerScreen,
ScreenContext,
} from './components/Screen';

export {
default as ScreenContainer,
NativeScreenContainer,
NativeScreenNavigationContainer,
} from './components/ScreenContainer';

export { default as ScreenStack } from './components/ScreenStack';

export {
ScreenStackHeaderConfig,
ScreenStackHeaderSubview,
Expand All @@ -39,28 +30,12 @@ export {
ScreenStackHeaderSearchBarView,
} from './components/ScreenStackHeaderConfig';

export {
default as SearchBar,
NativeSearchBar,
NativeSearchBarCommands,
} from './components/SearchBar';

export { default as SearchBar } from './components/SearchBar';
export { default as ScreenContainer } from './components/ScreenContainer';
export { default as ScreenStack } from './components/ScreenStack';
export { default as FullWindowOverlay } from './components/FullWindowOverlay';

export {
default as ScreenFooter,
NativeScreenFooter,
} from './components/ScreenFooter';

export {
default as ScreenContentWrapper,
NativeScreenContentWrapper,
} from './components/ScreenContentWrapper';

/**
* Modules
*/
export { default as NativeScreensModule } from './fabric/NativeScreensModule';
Comment on lines -60 to -63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uff, isn't it consumed in reanimated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a module, not a component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not used anywhere, so I removed that as well. Imo all functions from it should go through our proxy. But I can revert this change.

export { default as ScreenFooter } from './components/ScreenFooter';
export { default as ScreenContentWrapper } from './components/ScreenContentWrapper';

/**
* Contexts
Expand Down
Loading