SteffeyDev / react-native-popover-view

A well-tested, adaptable, lightweight <Popover> component for react-native
MIT License
614 stars 92 forks source link

The popover never displays when in TOOLTIP mode #92

Closed peresbri-apthletic closed 3 years ago

peresbri-apthletic commented 3 years ago

I want to make sure taps to the area around the popover fall through to those views so I am using the TOOLTIP mode. but this is not displaying anything anymore. I am doing something wrong? How is the display are calculated in this case?

Cheers

<Popover
          isVisible={popoverOpen}
          mode={PopoverMode.TOOLTIP}
          from={fromRect}
          // debug
          animationConfig={{duration: 100}}
          verticalOffset={0}
          placement={(this.props.position as PopoverPlacement) || PopoverPlacement.LEFT}
          backgroundStyle={styles.transparentBackground}
          arrowStyle={this.props.noArrow ? styles.noArrowStyle : styles.arrowStyle}
          onRequestClose={this.hidePopover}
          onOpenStart={() => console.log("onOpenStart")}
          onOpenComplete={() => console.log("onOpenComplete")}
          onCloseStart={() => console.log("onCloseStart")}
          onCloseComplete={() => console.log("onCloseComplete")}
          popoverStyle={popOverStyle}>
          <View style={{backgroundColor: "yellow", width: 100, height: 100}}>
            <Text>asdfasfsdafsaf</Text>
          </View>
        </Popover>
SteffeyDev commented 3 years ago

For usage in TOOLTIP mode, it is very important that all parents of the Popover fill the screen, both height and width, if at all possible. This may involve putting the Popover higher up in the hierarchy than you typically would. Avoid putting the popover inside of a scroll container.

The debug output should help in identifying where the popover is showing. It is most likely appearing off the screen, or else is not given enough space to display at all.

pinpolygons commented 3 years ago

For usage in TOOLTIP mode, it is very important that all parents of the Popover fill the screen, both height and width, if at all possible. This may involve putting the Popover higher up in the hierarchy than you typically would. Avoid putting the popover inside of a scroll container.

The debug output should help in identifying where the popover is showing. It is most likely appearing off the screen, or else is not given enough space to display at all.

how can I use it in Flatlist?

SteffeyDev commented 3 years ago

You should either avoid tooltip mode for using in FlatList, or if you must use tooltip mode, put the popover outside the FlatList, use ref or rect for the from prop, and control visibility manually. I think passing in a ref from a button in a FlatList will still properly calculate the actual position on screen.

peresbri-apthletic commented 3 years ago

@SteffeyDev thanks for the tips mate. I have parked that issue for now. Will keep you posted when I work on it again. Cheers

SteffeyDev commented 3 years ago

Closing due to inactivity