import * as React from 'react'; import { View, Text } from 'react-native-ui-lib'; import Carousel from 'rn-animated-carousel'; import { window } from '../constants'; import Animated, { Easing } from 'react-native-reanimated'; const PAGE_WIDTH = window.width / 2; function ReactionContainer(props: { text: string; children: ( text: React.ReactElement, layout?: { width: number } ) => React.ReactElement; }) { const [width, setWidth] = React.useState(); const [layout, setLayout] = React.useState<{ width: number }>(); React.useEffect(() => { if (typeof width === 'number') { setLayout({ width }); } }, [width]); React.useEffect(() => { setLayout(undefined); }, [props.text]); const text = ( { if (typeof layout === 'undefined') { setWidth(nativeEvent.layout.width); } }} > {props.text} ); return React.cloneElement(props.children(text, layout), { key: props.text, }); } function Index() { return ( {(text, layout) => { return ( text} enabled={false} /> ); }} ); } export default Index;