jaredpalmer / jaredpalmer/formik

useLayoutEffect is never used in React Native

Open
#2,011 0 comments 0 reactions 0 assignees View on GitHub
Focus: React-Native stale Type: Enhancement
Dominant language
TypeScript
Stars
34.3k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug report

### Current Behavior

The implementation of `useIsomorphicLayoutEffect` leads to `useEffect` being used in React Native where `useLayoutEffect` is intended.

More info here: https://github.com/reduxjs/react-redux/pull/1444

### Expected behavior

Formik should be calling `useLayoutEffect` in React Native.

### Reproducible example

None yet, as I'm not sure how this bug affects Formik specifically.

### Suggested solution(s)

Copy the solution from https://github.com/reduxjs/react-redux/pull/1444 or use [react-layout-effect](https://www.npmjs.com/package/react-layout-effect) to share code with other libraries (eg: `react-spring` will be using it).

If you decide to use `react-layout-effect`, let me know and I'll add you as a maintainer.

### Your environment

N/A, all versions affected

Contributor guide

Open the contributing guide

Research direction

Start by locating the useIsomorphicLayoutEffect implementation in Formik and compare its React Native behavior with the Redux React recommendation linked in the issue. Check the react-layout-effect option as an alternative. Done means React Native uses useLayoutEffect as expected, with the affected behavior covered by an appropriate test if the existing test structure supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.