You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The component's documentation and prop types declarations violently disagree with its implementation. When I use the component as documented in the README, I get the following warning in my console:
Warning: Failed prop type: Invalid prop `component` of type `object` supplied to `PlaidLink`, expected `function`.
Given the following implementation in PlaidLink.js:
exportconstPlaidLink=({
component,
componentProps,
children,
...linkProps})=>{// 🚨 NOTE: the following line doesn't take care to defend against `undefined`constComponent=component;return(<Component{...componentProps}onPress={()=>handlePress(linkProps,componentProps)}>{children}</Component>);};
PlaidLink.propTypes = {
// skip irrelevant bits...
// Underlying component to render 🚨 NOTE: this fails to support class components
component: PropTypes.func,
// everything else...
};
… it is clear that the PlaidLink component requires the component prop, though there is presently no documentation as to the requirements for that component (which I'm assuming exist, as the placement of that component includes an onPress prop, which means using a View is off the table, as it doesn't support that prop.
Further, the prop type declaration only accepts a function, which results in a prop type warning (see my note in the comment addendum to the prop type declaration code sample above) when supplying something like component={TouchableOpacity}, which actually works.
This problem has been around since 3 Dec 2019, introduced by this commit. Notably this change wasn't accompanied by a corresponding update to the components usage documentation the README file (nor has any subsequent update introduced this needed update).
Environment
Plaid Link React Native
5.0.2
ReactNative Version
0.63.2
Occurs on Android
?
Android OS Version
n/a
Android Devices/Emulators
n/a
Occurs on iOS
yes
iOS Version
14
iOS Devices/Emulators
all
Steps to Reproduce
Nothing special needed; simply use the component in dev mode and you'll see the problem.
Expected Result
I expected the component prop to be optional, and the PlaidLink component to work properly without it.
Screenshots
No real value to a screen shot of warning text.
Logs
Any relevant logs from Android Logcat or the iOS console including stacktraces.
Code To Reproduce Issue
Again, all you need to do is use the code from the usage documentation to get this result.
The text was updated successfully, but these errors were encountered:
prometheas
changed the title
Undocumented break in BC for PlaidLink component by addition of component prop in December 2019
Bad prop type declaration and documentation for PlaidLink component's component prop
Oct 1, 2020
UPDATE: I modified this issue's report after noticing that the component does define TouchableOpacity as the default component type to use, in the absence of an explicit value 😅
The problem
The component's documentation and prop types declarations violently disagree with its implementation. When I use the component as documented in the
README
, I get the following warning in my console:Given the following implementation in
PlaidLink.js
:And the following prop type definition for the
component
prop:… it is clear that the
PlaidLink
component requires thecomponent
prop, though there is presently no documentation as to the requirements for that component (which I'm assuming exist, as the placement of that component includes anonPress
prop, which means using aView
is off the table, as it doesn't support that prop.Further, the prop type declaration only accepts a function, which results in a prop type warning (see my note in the comment addendum to the prop type declaration code sample above) when supplying something like
component={TouchableOpacity}
, which actually works.This problem has been around since 3 Dec 2019, introduced by this commit. Notably this change wasn't accompanied by a corresponding update to the components usage documentation the README file (nor has any subsequent update introduced this needed update).
Environment
Steps to Reproduce
Nothing special needed; simply use the component in dev mode and you'll see the problem.
Expected Result
I expected the
component
prop to be optional, and thePlaidLink
component to work properly without it.Screenshots
No real value to a screen shot of warning text.
Logs
Any relevant logs from Android Logcat or the iOS console including stacktraces.
Code To Reproduce Issue
Again, all you need to do is use the code from the usage documentation to get this result.
The text was updated successfully, but these errors were encountered: