Skip to content

Image & View: add snack examples to use functional components#1582

Merged
nearestnabors merged 10 commits intofacebook:masterfrom
amandeepmittal:master
Feb 17, 2020
Merged

Image & View: add snack examples to use functional components#1582
nearestnabors merged 10 commits intofacebook:masterfrom
amandeepmittal:master

Conversation

@amandeepmittal
Copy link
Copy Markdown
Contributor

In Reference to #1579

This PR adds a Snack Example for <Image/> component with a use case for a functional component.

@react-native-bot
Copy link
Copy Markdown

react-native-bot commented Feb 5, 2020

Deploy preview for react-native ready!

Built with commit 743fd2d

https://deploy-preview-1582--react-native.netlify.com

Changes to docs/ are reflected in the next "master" version.

Thank you for your contributions.

How to ContributeDocumentation Sources

@amandeepmittal amandeepmittal changed the title Image #1579: add snack examples to use functional components Image: add snack examples to use functional components Feb 5, 2020
@amandeepmittal amandeepmittal changed the title Image: add snack examples to use functional components Image & View: add snack examples to use functional components Feb 5, 2020
@Simek
Copy link
Copy Markdown
Collaborator

Simek commented Feb 7, 2020

Few semicolons are missing mainly after export statements, I would prefer arrow functions over function keyword (most of new examples before #1579 was written this way) and I would also extract styles in DisplayAnImage Functional Component example but other than that LGTM.

@nearestnabors
Copy link
Copy Markdown
Contributor

@amandeepmittal can you make the changes @Simek suggested?

Copy link
Copy Markdown
Contributor

@nearestnabors nearestnabors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow @Simek's suggestions! #1582 (comment) Thank you both!

@amandeepmittal
Copy link
Copy Markdown
Contributor Author

amandeepmittal commented Feb 16, 2020

Oh, my apologies to both of you @rachelnabors and @Simek but I missed the notifications. 🙏
I will update it with the changes.

@amandeepmittal
Copy link
Copy Markdown
Contributor Author

Hey @Simek I have made changes as you suggested. Couldn't find any missing semi colons, also, I am using the same prettier config as the repo states.

</View>
);
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon 😉

@@ -61,8 +188,14 @@ export default class DisplayAnImageWithStyle extends Component {
);
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon 😉

docs/view.md Outdated
<Text>Hello World!</Text>
</View>
);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon 😉

docs/view.md Outdated
import React from 'react';
import { View, Text } from 'react-native';

const ViewBoxesWithColorAndText= () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space 😉

Rachel Nabors added 2 commits February 17, 2020 15:10
Ran code through prettier
Fixing a problem with code md
@nearestnabors nearestnabors merged commit 3a158f9 into facebook:master Feb 17, 2020
@amandeepmittal
Copy link
Copy Markdown
Contributor Author

Sorry about that @Simek I thought the prettier config of the repo was handling it.

Thank you @rachelnabors for this opportunity.

@Simek
Copy link
Copy Markdown
Collaborator

Simek commented Feb 18, 2020

@amandeepmittal No problem, thank you for the contribution! 😄

kaioduarte pushed a commit to kaioduarte/react-native-website that referenced this pull request Feb 24, 2020
…ok#1582)

* convert examples to use functions

* Update image.md

* Removing first and final ```

* Removing first and final ``` from second code snippet

* View: add snack + functional component example

* arrow functions over function keyword

* Image: arrow functions and extracted styles

* Update view.md

Ran code through prettier

* Update image.md

Fixing a problem with code md

Co-authored-by: Rachel Nabors <rachelnabors@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

4 participants