Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize code examples in the direct manipulation section #2189

Merged
merged 2 commits into from
Sep 1, 2020
Merged

Modernize code examples in the direct manipulation section #2189

merged 2 commits into from
Sep 1, 2020

Conversation

steveluscher
Copy link
Contributor

@steveluscher steveluscher commented Aug 31, 2020

The examples in the Direct Manipulation section look to have fallen victim to a rogue codemod; they are currently a mix of functional and class syntax that doesn't actually work.

In this PR I do too many things (sorry):

  • fix indentation (2 spaces everywhere)
  • remove styles that don't aid in the understanding of the concept of direct manipulation
  • convert everything from class to functional/hooks syntax
  • repair the opacity example by dimming the button onPressIn instead of onPress
  • use conventional ref forwarding to achieve the desired effect in the example where we show how to forward the effect of setNativeProps from a wrapper component to a child component

T74535407

@react-native-bot
Copy link

react-native-bot commented Aug 31, 2020

Deploy preview for react-native ready!

Built with commit 833a924

https://deploy-preview-2189--react-native.netlify.app

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

Thank you for your contributions.

How to ContributeDocumentation Sources

Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

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

@steveluscher thank you so much for improving those examples and updating the related sentences, great work! Also the changes description is very informative, thank you for that too! 🙂

Review comment: I have added missing useRef import (https://deploy-preview-2189--react-native.netlify.app/docs/next/direct-manipulation#setnativeprops-to-clear-textinput-value) and pass the examples code through the Prettier (currently JSX in MD files is not correctly formatted when running yarn prettier script from this repository).

@Simek Simek merged commit a781893 into facebook:master Sep 1, 2020
@steveluscher
Copy link
Contributor Author

Thanks for the catch and the cleanup! 🎉

slorber pushed a commit to react-native-website-migration/react-native-website that referenced this pull request Oct 9, 2020
* Update introduction.md (facebook#2181)

Hooks were introduced in React Native 0.59, not 0.58.

* adding snack player instead of images for flexbox (facebook#2171)

* adding snack player instead of images for flexbox

* chore: revert yarn.lock

* minor changes and improvements, prettier run on examples

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* UI & UX Design with InputAccessoryView (facebook#2183)

* UI Design with InputAccessoryView 

* Update inputaccessoryview.md

* small tweaks

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* update TextInput example, refs facebook#2187

* add TOC and improve formatting on the Android publishing page

* Modernize code examples in the direct manipulation section (facebook#2189)

* Modernize code examples in the direct manipulation section.

* small code tweaks/fixes + run code through Prettier

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* update Alert API page, include iOS specific functions from deprecated AlertIOS (facebook#2184)

Thanks for this one, @Simek!

* Update getting-started.md (facebook#2194)

Python2 & Python3 are both compatible

* fix homepage showcase app list graphical issue (facebook#2185)

Co-authored-by: R Nabors <rachelnabors@users.noreply.github.com>

* docs: add matrix to transform (facebook#2197)

* Bump decompress from 4.2.0 to 4.2.1 in /website (facebook#2200)

Bumps [decompress](https://github.com/kevva/decompress) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/kevva/decompress/releases)
- [Commits](kevva/decompress@v4.2.0...v4.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Typo fix (facebook#2202)

* fixes facebook#2201, delete duplicated TOC, add note about removal to TabBarIOS pages

* docs: update deprecated usage of findNodeHandle in measureLayout (facebook#2199)

* docs: update deprecated usage of findNodeHandle in measureLayout

* minor text and Snack tweaks, prettier run

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* bump alex and node-fetch, fix new alex warning

* typo fix

* TextInput: Add `onPressIn` and `onPressOut` docs (facebook#2205)

Original summary by @yungsters in [1b994f9](facebook/react-native@b7b0e23):
Introduces support for `onPressIn` and `onPressOut` on the `TextInput` component.

This makes it possible to add visual feedback when users touch interact with `TextInput` components.

* Fix typos (facebook#2204)

* link out-of-tree platforms, add macOS platform, unify dashes on homepage (facebook#2186)

* link out-of-tree platforms, add macOS, unify dashes on homepage

* revert dashes changes

* update SectionList page, extract ViewToken, add labels (facebook#2191)

* update TextInput press callbacks type, refs facebook#2205

* Added workarounds for TextInputs (facebook#2203)

* Added workarounds for TextInputs

* provide info on the focus management using <Modal>

* small text tweaks

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* update Text page and add types, add LayoutEvent object page (facebook#2209)

* Incorrect command (facebook#2207)

https://github.com/react-native-community/cli/blob/master/docs/commands.md#run-android

`--variant [string]`

* Updated ScrollView `disableIntervalMomentum` doc. (facebook#2211)

* Remove announcement banner. (facebook#2213)

* Docs: Removing `onTextInput` prop from TextInput (facebook#2216)

* Removing `onTextInput` prop from TextInput doc.

* Removing `onTextInput` prop from TextInput on version 0.62 & 0.63.

* Signing not under General for me (facebook#2214)

* Update running-on-simulator-ios.md (facebook#2220)

We have to specify the generation for the iPhone SE simulator.

* [DOC] fixed errata in image doc (facebook#2221)

* Add documentation for Hermes sampling profiler (facebook#2159)

Co-authored-by: Saphal Patro <31125345+saphal1998@users.noreply.github.com>
Co-authored-by: R Nabors <rachelnabors@users.noreply.github.com>
Co-authored-by: Saphal Patro <saphal1998@gmail.com>

* Adding Android NDK Installation Guide (facebook#2225)

* Docs: Integration with android fragment (facebook#2217)

Co-authored-by: Sebastien Bailouni <sbailouni@gmail.com>

* Add new option to ActionSheetIOS called disabledButtonsIndices (facebook#1898)

* Adding configureNext.onAnimationDidFail callback on LayoutAnimation (facebook#2136)

Co-authored-by: Christoph Nakazawa <cpojer@fb.com>

* Added Coinbase to showcase (facebook#2227)

* Added Coinbase to showcase

* Add Coinbase icon

* 0.63.3 release - update Pressable delay (facebook#2226)

* Improved README.md (facebook#2233)

* fix typo (facebook#2232)

* fix typo

fixes typo in "Using Custom Path Aliases with TypeScript" section (configure -> configuring)

* sentence rewrite

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* Add Shopify and Tableau to showcase (facebook#2228)

* Add Shopify in showcase

* Add Shopify icon

* Add Tableau to showcase

* Add tableau image asset

* Update Tableau icon

* updated debugging.md (facebook#2241)

fixed a typo in unhandled error

* Update appregistry.md (facebook#2246)

* Update out-of-tree-platforms.md (facebook#2243)

* Remove unnecessary python dependency (facebook#2250)

Python is not required anymore on windows platform. The only binary addon for react-native project are some deps of `ws`, [which now have prebuilt binary and are optional](https://github.com/websockets/ws#opt-in-for-performance-and-spec-compliance). 
Tested on a brand new windows 10 image with only node installed, the initiating process goes well.

* Update network.md to show android non ssl block (facebook#2245)

* Update network.md to show android non ssl block

added note for android's android:usesCleartextTraffic flag in manifest file to allow non ssl encrypted networking - to go alongside the existing note for ios.

* small text tweaks

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* remove link in native-modules-ios (facebook#2244)

Co-authored-by: luism3861 <eduardo_media@fragua.com.mx>

* Update textinput.md (facebook#2249)

* Update textinput.md

This will make it more clear for beginners who are trying to use onBlur to do a final action on their textInput's text value.

* formatting, text tweaks

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>

* revert change to Netlify config due to V2 test merge

Co-authored-by: Georgios Kotziabassis <kotziabassis@gmail.com>
Co-authored-by: Muhammad Saeed <37156636+Stringsaeed@users.noreply.github.com>
Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>
Co-authored-by: Mojtaba Vandaei <62926492+mojvan@users.noreply.github.com>
Co-authored-by: Steven Luscher <steveluscher@users.noreply.github.com>
Co-authored-by: Pratik Khandelwal <prkhandelwal@hotmail.com>
Co-authored-by: R Nabors <rachelnabors@users.noreply.github.com>
Co-authored-by: Jesse Katsumata <jesse.katsumata@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joe Bernard <joe@joebernard.com>
Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
Co-authored-by: Luis Miguel Alvarado <luismiguel1730@gmail.com>
Co-authored-by: Pramod Kotipalli <p13i@users.noreply.github.com>
Co-authored-by: Madd.is <github@madd.is>
Co-authored-by: Kirill <laikisounds@gmail.com>
Co-authored-by: Ashwin Mothilal <ashwin.mothilal2124@gmail.com>
Co-authored-by: Christoph Nakazawa <cpojer@fb.com>
Co-authored-by: captDaylight <paul.christophe6@gmail.com>
Co-authored-by: ppichier <pierantonio.pichierri@gmail.com>
Co-authored-by: Varunendra Pratap Singh <vpsingh016@gmail.com>
Co-authored-by: Jessie Anh Nguyen <47696418+jessieAnhNguyen@users.noreply.github.com>
Co-authored-by: Saphal Patro <31125345+saphal1998@users.noreply.github.com>
Co-authored-by: Saphal Patro <saphal1998@gmail.com>
Co-authored-by: Agastya Darma <gedeagas22@gmail.com>
Co-authored-by: Steven Martin <stevenisekimartin@gmail.com>
Co-authored-by: Sebastien Bailouni <sbailouni@gmail.com>
Co-authored-by: Luke Walczak <lukasz.walczak.pwr@gmail.com>
Co-authored-by: Jessica Lin <jlin2700@gmail.com>
Co-authored-by: Vishal Vishwakarma <56310842+vishalvishw10@users.noreply.github.com>
Co-authored-by: Adam Hunter <arhunter@gmail.com>
Co-authored-by: Jessica Lin <jplin@fb.com>
Co-authored-by: Ashish Shakya <41261918+Ashish1101@users.noreply.github.com>
Co-authored-by: Sunny Luo <sunnylqm@gmail.com>
Co-authored-by: Alexander Sklar <asklar@microsoft.com>
Co-authored-by: s-maurice <51819025+s-maurice@users.noreply.github.com>
Co-authored-by: luism3861 <36824170+luism3861@users.noreply.github.com>
Co-authored-by: luism3861 <eduardo_media@fragua.com.mx>
Co-authored-by: Ralph Maamari <ralphpal@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants