UNPKG

react-native-screen-transitions

Version:
44 lines (41 loc) 1.23 kB
"use strict"; import { memo } from "react"; import { StyleSheet, View } from "react-native"; import Animated, { useAnimatedStyle } from "react-native-reanimated"; import { NO_STYLES } from "../constants"; import { useTransitionStyles } from "../providers/transition-styles"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export const RootTransitionAware = /*#__PURE__*/memo(({ children }) => { const { stylesMap } = useTransitionStyles(); const animatedContentStyle = useAnimatedStyle(() => { "worklet"; return stylesMap.value.contentStyle || NO_STYLES; }); const animatedOverlayStyle = useAnimatedStyle(() => { "worklet"; return stylesMap.value.overlayStyle || NO_STYLES; }); return /*#__PURE__*/_jsxs(View, { style: styles.container, children: [/*#__PURE__*/_jsx(Animated.View, { style: [StyleSheet.absoluteFillObject, animatedOverlayStyle], pointerEvents: "none" }), /*#__PURE__*/_jsx(Animated.View, { style: [styles.content, animatedContentStyle], children: children })] }); }); const styles = StyleSheet.create({ container: { flex: 1 }, content: { flex: 1 } }); //# sourceMappingURL=root-transition-aware.js.map