react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

Property onPressLink doesn't work in older android versions

Open IgorX1725 opened this issue 5 years ago • 3 comments

Hi There,

I've used an implementation of react-native-pdf V6.2.0 with property onPressLink to redirect the user to native browser through link clicked like bellow:

            handleOpenExternalLink = (source) => {
              Linking.canOpenURL(source).then((supported) => {
                if (supported) {
                  Linking.openURL(source);
                } else {
                  Alert.alert(
                    I18n.t('screens.content.components.alert.pdf.messages.error.title'),
                    I18n.t('screens.content.components.alert.pdf.messages.error.message'),
                  );
                }
              });
            };

             return( 
                <PdfViewer
                  source={this.props.isFile ? uri : { uri }}
                  onPressLink={(source) => this.handleOpenExternalLink(source)}
                  onError={() => {
                    Alert.alert(ValidationErrors.alertErrorTitle, ContentText.openFileError, [
                      {
                        text: 'OK',
                        onPress: onBack,
                      },
                    ]);
                  }}
              />)

but i noticed it didn't work in older Android version .

Tests:

Galaxy S7 - Android 6 - didn't work Galaxy S8 Plus - Android 9 - worked Galaxy A30 - Android 10 - worked Xiaomi RedmiNote9pró - Android 10 - worked

have someone else passed by same issue?

thank you!

IgorX1725 avatar Jan 13 '21 23:01 IgorX1725

onPressLink Galaxy s20 - Android 11 - not working. Any updates?

nikkizol avatar Mar 06 '23 10:03 nikkizol

@wonday

nikkizol avatar Mar 06 '23 11:03 nikkizol

@IgorX1725 did you manage to fix it?

nikkizol avatar Mar 08 '23 11:03 nikkizol