joshswan/react-native-autolink

onTextLayout prop doesn't work

Aleksandern opened this issue · 1 comments

Hello.

Thank you for the component.

I noticed the onTextLayout prop doesn't work:

      <Autolink
        text="text"
        textProps={{
          onTextLayout: (e) => {
            console.log(e.nativeEvent.lines.length);
          },
        }}
      />

so I have to do like this:

      <Text
        onTextLayout={onTextLayout}
      >
        <Autolink
          text="text"
        />
      </Text>

Perhaps not obvious based on the name, but textProps is passed to non-link child Text nodes, not the main one. You should be able to just pass the prop directly:

<Autolink
  text="text"
  onTextLayout={(e) => {
    console.log(e.nativeEvent.lines.length);
  }}
/>