prscX / react-native-tooltips

React Native: Native Tooltip View
Apache License 2.0
271 stars 40 forks source link

Tooltip go off screen #48

Open Ilario17 opened 3 years ago

Ilario17 commented 3 years ago
showTooltip(target, parent, text) {
    RNTooltips.Show(
    target,
    parent,
    {
        text: text,
        tintColor: '#ffffff',
        textColor: '#4a4a4a',
        textSize: 16,
        duration: 1000,
        corner: 8,
        clickToHide: true,
        autoHide: true,
        duration: 3
    }
    )
}
<View ref={ref => this.parent = ref}>
    <View>
        <ScrollView>
            <View>
                <TouchableOpacity ref={ref => this.target = ref} onPress={() => this.showTooltip(this.target, this.parent, 'hello')}>
                </TouchableOpacity>
            </View>
        </ScrollView>
    <View> 
</View>

I'm testing with iOS 14.1, I noticed that with some dimensions there are no problems, for example setting width: 200 on the parent, but on the same component putting width: 300 or width: '100%' the tooltip goes off screen

armata99 commented 3 years ago

I have same problem on android, my screen is on landscape mode and the tooltip at the corner overlaps the OS soft keys. It also has a small offset on LANDSCAPE_RIGHT but its ok on the LANDSCAPE_LEFT

St1ggy commented 3 years ago

I have same problem on ios if element close to screen edge image in Example folder image