Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use RNTooltips API in functional components #43

Open
shivam-880 opened this issue Jan 26, 2020 · 2 comments
Open

How to use RNTooltips API in functional components #43

shivam-880 opened this issue Jan 26, 2020 · 2 comments

Comments

@shivam-880
Copy link

shivam-880 commented Jan 26, 2020

Hi @prscX,

I am not able to figure out how would I really use RNTooltips API with functional components. Please guide.

null is not an object (evaluating 'RNTooltips.Show')

Show
RNToolTips.js:118:15

I am trying to raise tool tips upon onDayLongPress on a https://github.com/wix/react-native-calendars.

What I have done so far is:

   const [parent, setParent] = useState(null);

    const _onDayLongPress = e => {
            RNTooltips.Show(
                parent,
                parent,
                {
                    text: 'Long Press Description'
                }
            )
    }
     <Calendar
          ref={setParent}
          onDayLongPress={_onDayLongPress}
      />
@juansimon666
Copy link

This happen to me, it was a link problem on iOS, i used pods.

@ChengBenj
Copy link

@codingkapoor
try this
`const target = useRef(null);
const parent = useRef(null);
const [visible, setVisible] = useState(false);

return (
    <View ref={parent}>
        <TouchableOpacity onPress={() => setVisible(true)} ref={target}>
            <View>
                <Text>Click me</Text>
            </View>
        </TouchableOpacity>
        <RNTooltips
            text="Test"
            visible={visible}
            target={target.current}
            parent={parent.current}
            onHide={() => setVisible(false)}
            clickToHide
        />
    </View>
);

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants