can-it-be-done-in-react-native icon indicating copy to clipboard operation
can-it-be-done-in-react-native copied to clipboard

Measurement of child component

Open StackTraceYo opened this issue 4 years ago • 1 comments

Hi first of all thanks I love your vidoes.

In the measurement video and the code under reanimated2/accordion, I am having issues updating your example to accept a child component.

Specifically I have tried to add a<CalendarList/> from https://github.com/wix/react-native-calendars instead of the items list we are using in the tutorial but the height does not take it into account for some reason. Any input would be appreciated.

below is the code I changed

 <Animated.View style={[styles.items, style]}>
        <View
          ref={aref}
          onLayout={({
            nativeEvent: {
              layout: { height: h },
            },
          }) => {
            console.log(h);
          }}
        >
          <CalendarList
            pastScrollRange={0}
            futureScrollRange={3}
            horizontal
          />
        </View>
        {/*{list.items.map((item, key) => (*/}
        {/*  <Item*/}
        {/*    key={key}*/}
        {/*    isLast={key === list.items.length - 1}*/}
        {/*    {...{ item }}*/}
        {/*  />*/}
        {/*))}*/}
      </Animated.View>
`

StackTraceYo avatar Feb 15 '21 23:02 StackTraceYo

I've the same issue. It seems the height of the View is not the actual height of their children when collapsed. Neither onLayout nor measure getting the correct height.

NehrDani avatar May 26 '21 09:05 NehrDani