From 35120d9f8a2b017d406d18c2422af283bb82f430 Mon Sep 17 00:00:00 2001 From: Krzysztof Magiera Date: Fri, 12 Oct 2018 13:52:22 +0200 Subject: [PATCH] Export native screen components so that they can be wrapped in reanimated view wrapper --- src/screens.d.ts | 5 ++++- src/screens.native.js | 12 ++++++------ src/screens.web.js | 4 ++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/screens.d.ts b/src/screens.d.ts index f5d92cca..ccf85800 100644 --- a/src/screens.d.ts +++ b/src/screens.d.ts @@ -7,7 +7,7 @@ declare module 'react-native-screens' { export function useScreens(shouldUseScreens?: boolean): void; export function screensEnabled(): boolean; - + export interface ScreenProps extends ViewProps { active?: boolean; onComponentRef?: (view: any) => void; @@ -16,4 +16,7 @@ declare module 'react-native-screens' { export type ScreenContainerProps = ViewProps; export const ScreenContainer: ComponentClass; + + export const NativeScreen: ComponentClass; + export const NativeScreenContainer: ComponentClass; } diff --git a/src/screens.native.js b/src/screens.native.js index e85f0bb9..76448d1f 100644 --- a/src/screens.native.js +++ b/src/screens.native.js @@ -29,11 +29,11 @@ export function screensEnabled() { return USE_SCREENS; } -const NativeScreen = Animated.createAnimatedComponent( - requireNativeComponent('RNSScreen', null) -); +export const NativeScreen = requireNativeComponent('RNSScreen', null); -const NativeScreenContainer = requireNativeComponent( +const AnimatedNativeScreen = Animated.createAnimatedComponent(NativeScreen); + +export const NativeScreenContainer = requireNativeComponent( 'RNSScreenContainer', null ); @@ -59,7 +59,7 @@ export class Screen extends React.Component { } else { const { style, children, ...rest } = this.props; return ( - @@ -71,7 +71,7 @@ export class Screen extends React.Component { and avoid wrapping with `Animated.View`. */} {children} - + ); } } diff --git a/src/screens.web.js b/src/screens.web.js index 24cc60b1..7177ef57 100644 --- a/src/screens.web.js +++ b/src/screens.web.js @@ -13,3 +13,7 @@ export function screensEnabled() { export const Screen = Animated.View; export const ScreenContainer = View; + +export const NativeScreen = View; + +export const NativeScreenContainer = View;