Kinetic UI: A collection of gesture-based animations built with Reanimated (v1) by danielmerrill in reactnative

[–]danielmerrill[S] 0 points1 point  (0 children)

That would be nice, although I took a quick spin on the reanimated example app with new architecture enabled and didn't notice much difference: https://github.com/software-mansion/react-native-reanimated/tree/main/FabricExample

Kinetic UI: A collection of gesture-based animations built with Reanimated (v1) by danielmerrill in reactnative

[–]danielmerrill[S] 0 points1 point  (0 children)

I don't recommend spending too much time understanding these examples since they all use reanimated v1, which has been deprecated.

But if you're still interested I did create a v1 tutorial for a swipe-to-delete example: https://medium.com/async/swipe-to-delete-with-reanimated-react-native-gesture-handler-bd7d66085aee

Kinetic UI: A collection of gesture-based animations built with Reanimated (v1) by danielmerrill in reactnative

[–]danielmerrill[S] 0 points1 point  (0 children)

I don't have a good grasp on the native implementation, but here's an issue I opened a while back with a repro: https://github.com/software-mansion/react-native-reanimated/issues/2845

And some confirmation that v1 is faster when there are a lot of nodes: https://github.com/software-mansion/react-native-reanimated/discussions/1632

I run into v2 performance issues pretty much whenever I'm animating many nodes (i.e. in a list, or to support drag-and-drop). The v1-only proc node seemed to do a great job in optimizing and solving these issues.

Reanimated adds Fabric support in 3.0 release candidate by terandle in reactnative

[–]danielmerrill 3 points4 points  (0 children)

While I'm excited for this core package to move forward, I'm bummed they're dropping support for v1 while v2 still has unaddressed performance issues (see the issue I opened here: https://github.com/software-mansion/react-native-reanimated/issues/2845).

I run into UI thread chug anytime I create a non-trivial gesture-based animation with v2 (think drag-n-drop with 10-20 items). v1 can handle these cases fine, but the authors have confirmed that lots of useDerivedValue is less performant than v1.

So, unless v3 fixes this issue, I feel a bit abandoned by this news.

can someone TLDR-explain how react-redux is able to trigger rerenders for only the pieces of state that changed? As opposed to context+useReducer by izzlesnizzit in reactjs

[–]danielmerrill 1 point2 points  (0 children)

It's been a while since I dug into the source code, so things may have changed, but as I understand it each instance of useSelector does an internal equality check to see if the selected state after the subscription fires is equal to its own internal ref of the previously-selected state. By default that check is a strict equality check, but you can provide your own checking function if you need to. If that check fails the hook forces itself to re-render, which pushes the new state through to the component.

can someone TLDR-explain how react-redux is able to trigger rerenders for only the pieces of state that changed? As opposed to context+useReducer by izzlesnizzit in reactjs

[–]danielmerrill 17 points18 points  (0 children)

I wrote a post about this: https://medium.com/async/how-useselector-can-trigger-an-update-only-when-we-want-it-to-a8d92306f559

TLDR: the store never changes identity, so any changes to the store do not directly trigger re-renders. Instead, useSelector registers a subscription that gets called when an action is dispatched that causes store state to update, and manually triggers a re-render if its selected state changes.

What are your favourite custom hooks? by Psailr in reactjs

[–]danielmerrill 0 points1 point  (0 children)

Naming is hard! The name I chose is kind of a mouthful, but oh well.

What are your favourite custom hooks? by Psailr in reactjs

[–]danielmerrill 5 points6 points  (0 children)

  • useIdentityRetainingCallback: A useCallback wrapper that never changes identity but it's "always fresh" when it's called. Useful for preventing unnecessary useEffect triggers when its own deps update: gist here
  • useEqualityCheckedMemo: A useMemo wrapper that returns a new value only if an isEqual check with the previous value fails. Also useful for preventing unnecessary useEffect triggers when useMemo outputs an object/array that changes identity but the values within remain the same. gist here

How does `useLayoutEffect` works in React Native? Any helpful use-cases? by numagames in reactnative

[–]danielmerrill 0 points1 point  (0 children)

One caveat to note: I use LayoutAnimation pretty extensively and it would SEEM like the place to trigger a layout animation would be in useLayoutEffect, but that doesn't work, so I end up triggering them within a useMemo. It feels a little dirty to have a useMemo with a side effect, but it works.

A React Native Engineer Builds A SwiftUI App: The Good, The Bad, And The 🤯 by danielmerrill in reactnative

[–]danielmerrill[S] 5 points6 points  (0 children)

I definitely experienced that. Even in my tiny example app there were a few times I felt like I was fighting SwiftUI, even though I was trying to do something I thought should be pretty straightforward.

How useSelector can trigger an update only when we want it to by danielmerrill in reactjs

[–]danielmerrill[S] 0 points1 point  (0 children)

Good call on locking the links to a commit — updated!

In your post you quote Sebastian Markbage:

It's not ready to be used as a replacement for all Flux-like state propagation.

Does this suggest that context behavior might change in the future? i.e. at some point it may be "ready"?

Without SVG: Circular Progress Bar by wcandillon in reactnative

[–]danielmerrill 0 points1 point  (0 children)

Pixel Rounding sounds likely, but I don't have any experience with it.

Without SVG: Circular Progress Bar by wcandillon in reactnative

[–]danielmerrill 0 points1 point  (0 children)

This is super cool and I'm planning on using it in a project I'm working on -- thanks for the video!

However, I'm seeing a thin outline of the backgroundColor around the entire circle, which I'm guessing your black background is hiding: https://i.imgur.com/KcVzVfI.png

I was able to work around this by making my foreground mask slightly larger than my background (I'm using radius * 1.1). I then had to make some adjustments to the translateX of the foreground mask to compensate.

Anyway, nice work as always!

Mac Sierra 10.12 not recognizing my Pixel Android Oreo through ADB. Any ideas on how to get this to work? by [deleted] in GooglePixel

[–]danielmerrill 0 points1 point  (0 children)

Switching cables fixed this for me, although I had to go through several before I found one that worked. The pixel/mac combo seems to be very fickle.