-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
flow: Annotate some more exported React components. #4914
Commits on Jul 27, 2021
-
flow: Use
Node
type exported from React, instead ofReact$Node
.These are equivalent, but Greg prefers this form because it seems cleaner. See https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/Flow.20types-first/near/1239060.
Configuration menu - View commit details
-
Copy full SHA for bf967cb - Browse repository at this point
Copy the full SHA bf967cbView commit details -
CreateGroupScreen [nfc]: Inline
handleFilterChange
.Like we did in 4aedc4c.
Configuration menu - View commit details
-
Copy full SHA for cf222c4 - Browse repository at this point
Copy the full SHA cf222c4View commit details -
ChooseRecipientsScreen [nfc]: Inline
handleFilterChange
.Like we did in 4aedc4c.
Configuration menu - View commit details
-
Copy full SHA for 3f3e68b - Browse repository at this point
Copy the full SHA 3f3e68bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c95507 - Browse repository at this point
Copy the full SHA 3c95507View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3293476 - Browse repository at this point
Copy the full SHA 3293476View commit details -
Configuration menu - View commit details
-
Copy full SHA for eb88f62 - Browse repository at this point
Copy the full SHA eb88f62View commit details -
UsersScreen [nfc]: Inline
handleFilterChange
.Like we did in 4aedc4c.
Configuration menu - View commit details
-
Copy full SHA for 080b29f - Browse repository at this point
Copy the full SHA 080b29fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4bc6dba - Browse repository at this point
Copy the full SHA 4bc6dbaView commit details -
AnimatedComponent [nfc]: Convert to function component.
Use `useRef` for `animatedValue` [1] [2]. Greg points out that we should choose `useEffect` over `useLayoutEffect` [3]. [1] https://reactjs.org/docs/hooks-faq.html#is-there-something-like-instance-variables [2] https://reactnative.dev/docs/animated [3] zulip#4914 (comment)
Configuration menu - View commit details
-
Copy full SHA for 9daafd2 - Browse repository at this point
Copy the full SHA 9daafd2View commit details
Commits on Jul 28, 2021
-
AnimatedComponent [nfc]: Initialize animatedValue based on
visible
.Currently, AnimatedComponent has only one caller, and it always starts by passing `false` for `visible`. Since it never passes `true` initially, the new path isn't exercised. But we should make it so future callers that pass `true` initially will actually see the element start as visible. So, do that. See more discussion at zulip#4914 (comment).
Configuration menu - View commit details
-
Copy full SHA for f92460c - Browse repository at this point
Copy the full SHA f92460cView commit details -
AnimatedComponent [nfc]: Dedupe target-value expression.
It's intentional that both of these expressions do the same thing: the point is that when the component first renders, it should start out in the desired state, and then when the desired state changes and causes a rerender it'll animate to the new desired state. So, we can make that explicit (and avoid some future change causing an accidental discrepancy) by writing the expression just once. Also because `visible` is already boolean, we can skip the `=== true`.
Configuration menu - View commit details
-
Copy full SHA for c7be42f - Browse repository at this point
Copy the full SHA c7be42fView commit details -
AnimatedComponent: Only call
animate
on visibility change.Instead of on every render, where it often ends up being unnecessary work.
Configuration menu - View commit details
-
Copy full SHA for 85d522d - Browse repository at this point
Copy the full SHA 85d522dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1176105 - Browse repository at this point
Copy the full SHA 1176105View commit details -
Configuration menu - View commit details
-
Copy full SHA for 786b190 - Browse repository at this point
Copy the full SHA 786b190View commit details -
Configuration menu - View commit details
-
Copy full SHA for cc682d0 - Browse repository at this point
Copy the full SHA cc682d0View commit details -
Input [nfc]: Convert to function component.
Using `useContext(TranslationContext)` for the `GetText` function, instead of `withGetText`. (Since this is now a function component, we can subscribe to two different contexts, the other one being `ThemeContext`.)
Configuration menu - View commit details
-
Copy full SHA for 32187e9 - Browse repository at this point
Copy the full SHA 32187e9View commit details -
InputWithClearButton [nfc]: Remove unnecessary
canBeCleared
state.Greg points out [1] that `canBeCleared` is always the same as `text.length > 0`. So, just drop this piece of state and compute the value we need when we need it. [1] zulip#4914 (comment)
Configuration menu - View commit details
-
Copy full SHA for 6498bb0 - Browse repository at this point
Copy the full SHA 6498bb0View commit details -
Configuration menu - View commit details
-
Copy full SHA for c8776e4 - Browse repository at this point
Copy the full SHA c8776e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for c1a3c51 - Browse repository at this point
Copy the full SHA c1a3c51View commit details -
Configuration menu - View commit details
-
Copy full SHA for 726bb5d - Browse repository at this point
Copy the full SHA 726bb5dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5db4b92 - Browse repository at this point
Copy the full SHA 5db4b92View commit details -
Configuration menu - View commit details
-
Copy full SHA for f51bc79 - Browse repository at this point
Copy the full SHA f51bc79View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea65f05 - Browse repository at this point
Copy the full SHA ea65f05View commit details -
Configuration menu - View commit details
-
Copy full SHA for 45dc89c - Browse repository at this point
Copy the full SHA 45dc89cView commit details -
Configuration menu - View commit details
-
Copy full SHA for a421ed6 - Browse repository at this point
Copy the full SHA a421ed6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91145ed - Browse repository at this point
Copy the full SHA 91145edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 09e7077 - Browse repository at this point
Copy the full SHA 09e7077View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7d1087 - Browse repository at this point
Copy the full SHA a7d1087View commit details -
SmartUrlInput [nfc]: Convert to function component.
Using `useRef` for `unsubscribeFocusListener` [1]. We'll simplify the navigation-focus logic with `useFocusEffect` in the next commit. [1] https://reactjs.org/docs/hooks-faq.html#is-there-something-like-instance-variables
Configuration menu - View commit details
-
Copy full SHA for 12bec80 - Browse repository at this point
Copy the full SHA 12bec80View commit details -
SmartUrlInput: Use
useFocusEffect
.Following the doc at https://reactnavigation.org/docs/use-focus-effect/. Greg points out [1] that `useFocusEffect` seems to have the effect of calling the callback even on the component's first mount (if the screen is focused), whereas the old listener-based code would not. That doesn't seem to have a practical effect, here; empirically, it looks like the input gets focused anyway before this change. That's probably due to the `autoFocus` prop we pass to the `TextInput`. [1] zulip#4914 (comment).
Configuration menu - View commit details
-
Copy full SHA for 3f9cd6c - Browse repository at this point
Copy the full SHA 3f9cd6cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9effeaf - Browse repository at this point
Copy the full SHA 9effeafView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b01c9e - Browse repository at this point
Copy the full SHA 0b01c9eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 34eb383 - Browse repository at this point
Copy the full SHA 34eb383View commit details -
Configuration menu - View commit details
-
Copy full SHA for e2b23ce - Browse repository at this point
Copy the full SHA e2b23ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for d3f610f - Browse repository at this point
Copy the full SHA d3f610fView commit details -
Configuration menu - View commit details
-
Copy full SHA for a2f9ca9 - Browse repository at this point
Copy the full SHA a2f9ca9View commit details -
Configuration menu - View commit details
-
Copy full SHA for a66b701 - Browse repository at this point
Copy the full SHA a66b701View commit details -
Configuration menu - View commit details
-
Copy full SHA for a0d5cb7 - Browse repository at this point
Copy the full SHA a0d5cb7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a55fba - Browse repository at this point
Copy the full SHA 2a55fbaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6650e6e - Browse repository at this point
Copy the full SHA 6650e6eView commit details -
flow: Annotate some more exported React components.
This is much easier to do now that we've converted these to function components in this series. This will help move us along toward Flow's new "Types-First" mode; switching entirely is zulip#4907. Prefer the `Node` type exported from React over `React$Node`. They're equivalent, but Greg prefers `Node` as it seems cleaner; see https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/Flow.20types-first/near/1239060.
Configuration menu - View commit details
-
Copy full SHA for 81a50bb - Browse repository at this point
Copy the full SHA 81a50bbView commit details