octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/
MIT License
929 stars 157 forks source link

How to get current height of child View layout? #190

Closed xfishernet closed 3 years ago

xfishernet commented 3 years ago

How to get current height of child View layout?

djwillcaine commented 3 years ago
const Example = () => {
  const [viewHeight, setViewHeight] = useState(null);

  const onViewLayout = event => {
    setViewHeight(event.nativeEvent.layout.height);
  }

  return (
    <SlidingUpPanel>
      <View onLayout={onViewLayout}>
        <Text>The hight of View is {viewHeight} pixels.</Text>
      </View>
    </SlidingUpPanel>
  );
}