react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Fix StrictMode warnings

Open brunolemos opened this issue 7 years ago • 7 comments

Description

When wrapping the app with <StrictMode>, there are warnings coming from internal react native components. They need to be updated to stop using the legacy context api and unsafe methods like UNSAFE_componentWillReceiveProps.

Also, I believe this is a prerequisite for Concurrent Mode support.

Environment

Environment

React Native Environment Info: System: OS: macOS 10.14 CPU: x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz Memory: 33.30 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.11.4 - /usr/local/bin/node Yarn: 1.10.1 - ~/.yarn/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 Android SDK: Build Tools: 23.0.1, 23.0.3, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3 API Levels: 19, 22, 23, 24, 25, 26, 27, 28 IDEs: Android Studio: 3.2 AI-181.5540.7.32.5014246 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmGlobalPackages: react-native-cli: 2.0.1

brunolemos avatar Nov 06 '18 22:11 brunolemos

Will be working on this over the weekend.

Jyrno42 avatar Mar 29 '19 20:03 Jyrno42

Opened two PRs for ScrollView and AnimatedComponents/Touchables:

  • https://github.com/facebook/react-native/pull/24214
  • https://github.com/facebook/react-native/pull/24218

Jyrno42 avatar Mar 30 '19 21:03 Jyrno42

@Jyrno42 I see this is marked as help wanted. A few friends and I, Computer Science students, would love to help with this issue. Please let us know!

ConnorSBrady avatar Apr 03 '19 19:04 ConnorSBrady

@ConnorSBrady Feel free to grab the ScrollView/VirtualizedList - I am currently only working on createAnimatedComponent.

Jyrno42 avatar Apr 05 '19 09:04 Jyrno42

This is still valid, at least those 2 internal components are using unsafe callbacks:

  • AnimatedComponent
  • ScrollViewStickyHeader

It looks like ScrollViewStickyHeader was converted to a function component at some point, but this has been reverted and I am not sure why.

renchap avatar Jul 16 '22 19:07 renchap

Found another one:

findHostInstance_DEPRECATED was passed an instance of TouchableNativeFeedback

Indeeded findHostInstance_DEPRECATED is imported and used in TouchableNativeFeedback.js

obasille avatar Oct 21 '22 08:10 obasille

AnimatedComponent and ScrollViewStickyHeader are now StrictMode compatible.

AnimatedComponent resolved by https://github.com/facebook/react-native/commit/5e863fc42c8a2b27f4a785766eb643de9a243b2d ScrollViewStickyHeader resolved by https://github.com/facebook/react-native/commit/925e81ab86c9807b66d405d914e857b978b194fd

sammy-SC avatar Nov 03 '22 17:11 sammy-SC

@sammy-SC I am still getting warnings while using animated component in my react-native app while in StrictMode react-native: 0.70.7 react: 18.1.0 Simulator Screenshot - Rippling iPhone 14 - 2023-07-05 at 20 00 16

AdityaVandan avatar Jul 05 '23 14:07 AdityaVandan