Skip to content

Commit

Permalink
Fix default imageSource on Filters example (facebook#45799)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#45799

No idea how I missed this but I don't think `defaultProps` is a thing in React Native? So the images were not showing

Changelog: [internal]

Reviewed By: joevilches

Differential Revision: D60392853

fbshipit-source-id: 27280033fb719340a809053d6ca98ac3f178c8c3
  • Loading branch information
jorge-cab authored and facebook-github-bot committed Aug 1, 2024
1 parent bd0aedc commit 54a6438
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/rn-tester/js/examples/Filter/FilterExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ type Props = $ReadOnly<{
imageSource?: number,
}>;

const defaultProps = {
imageSource: hotdog,
};

function StaticViewAndImage(props: Props): React.Node {
return (
<>
Expand All @@ -47,20 +43,19 @@ function StaticViewAndImage(props: Props): React.Node {
</View>
<View style={styles.container}>
<Image
source={props.imageSource}
source={props.imageSource ?? hotdog}
style={[props.style, styles.commonImage]}
resizeMode="contain"
/>
<Image
source={props.imageSource}
source={props.imageSource ? props.imageSource : hotdog}
style={styles.commonImage}
resizeMode="contain"
/>
</View>
</>
);
}
StaticViewAndImage.defaultProps = defaultProps;

function StaticViewAndImageWithState(props: Props): React.Node {
const [s, setS] = React.useState(true);
Expand Down

0 comments on commit 54a6438

Please sign in to comment.