Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Warning: componentWillMount has been renamed #110

Open
isocra opened this issue Jan 7, 2020 · 9 comments
Open

Warning: componentWillMount has been renamed #110

isocra opened this issue Jan 7, 2020 · 9 comments

Comments

@isocra
Copy link

isocra commented Jan 7, 2020

I've just updated to using Expo SDK36 with React 16.9 and now I get

Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.

* Move code with side effects to componentDidMount, and set initial state in the constructor.
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: Signature

I can still use the signature component, but I need to get rid of the warning. Any chance of an update please?

Thanks

@vatto1337
Copy link

Also what's with the weird console logs ?
Screenshot 2020-01-23 at 09 20 13

@vrinch
Copy link

vrinch commented Mar 15, 2020

no updates on this yet?

@vatto1337
Copy link

vatto1337 commented Mar 15, 2020 via email

@josmontes
Copy link

josmontes commented Mar 27, 2020

Hello @isocra, i'm also using expo 36 but can't get the Signature component to work, could you please show me an example of how you got it to work? Also, the problem of componentWillMount is inside the expo-pixi/lib/components/Signature file, inside the node_module. Guess the team will have to update expo-pixi to stop using componentWillMount and use another hook instead.

@isocra
Copy link
Author

isocra commented Mar 28, 2020

Hi @josmontes, in the end we've had to roll back from using SDK36 because I couldn't get AWS AppSync to work. It turns out AWS were working on their new DataStore. At some stage soon we're going to have to refactor the app majorly so as to use that. I'm really hoping that expo-pixi will finally be brought up-to-date by then!

Meanwhile, this is what I had in my package.json that allowed me to run expo-pixi with SDK36 albeit still with all the warnings. There are some "relics" in the stuff below that you certainly don't need, but it seems better to give you too much than too little. Notice particularly the resolutions section at the bottom. I think you need to use yarn for this, see #93 (comment).

Good luck!

  "dependencies": {
    "@bugsnag/expo": "^6.4.0",
    "@expo/vector-icons": "^10.0.0",
    "@react-native-community/async-storage": "^1.7.1",
    "@react-native-community/netinfo": "4.6.0",
    "@redux-offline/redux-offline": "2.5.2-native.0",
    "apollo-cache-inmemory": "^1.6.5",
    "apollo-client": "2.4.6",
    "apollo-link-http": "^1.5.16",
    "aws-amplify": "2.2.1",
    "aws-amplify-react-native": "^2.1.11",
    "aws-appsync": "3.0.2",
    "aws-appsync-auth-link": "^2.0.1",
    "aws-appsync-react": "3.0.2",
    "aws-appsync-subscription-link": "^2.0.1",
    "debug": "^4.1.1",
    "expo": "^36.0.0",
    "expo-asset-utils": "^1.1.1",
    "expo-barcode-scanner": "~8.0.0",
    "expo-camera": "^8.0.0",
    "expo-constants": "~8.0.0",
    "expo-file-system": "~8.0.0",
    "expo-gl": "^8.0.0",
    "expo-image-picker": "^8.0.1",
    "expo-pixi": "1.0.1",
    "graphql": "^14.5.8",
    "graphql-tag": "^2.10.1",
    "moment": "^2.24.0",
    "mustache-formats": "^1.0.5",
    "react": "16.9.0",
    "react-apollo": "^2.5.8",
    "react-apollo-hooks": "^0.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
    "react-native-fs": "^2.13.3",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-image-view": "^2.1.4",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-maps": "^0.26.1",
    "react-native-paper": "^2.11.0",
    "react-native-vector-icons": "^6.4.2",
    "react-native-webview": "7.4.3",
    "react-navigation": "^3.11.0",
    "react-navigation-hooks": "^1.0.1",
    "recompose": "^0.30.0",
    "redux": "^4.0.4",
    "redux-logger": "^3.0.6",
    "styled-components": "^4.2.0",
    "tslib": "^1.9.3"
  },
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@types/debug": "^4.1.4",
    "@types/expo": "^33.0.0",
    "@types/expo__vector-icons": "^9.0.0",
    "@types/jest": "^24.0.15",
    "@types/react": "^16.8.16",
    "@types/react-native": "^0.60.0",
    "@types/react-native-material-ui": "^1.31.0",
    "@types/react-navigation": "^3.0.7",
    "@types/recompose": "^0.30.6",
    "@types/styled-components": "^4.4.2",
    "babel-preset-expo": "^8.0.0",
    "jest-expo": "^36.0.0",
    "prettier": "^1.17.0",
    "react-devtools": "^4.4.0",
    "react-native-debugger-open": "^0.3.24",
    "reactotron-react-native": "^4.0.2",
    "tslint": "^5.16.0",
    "tslint-config-prettier": "^1.18.0",
    "tslint-plugin-prettier": "^2.0.1",
    "typescript": "^3.4.5",
    "webpack": "^4.30.0"
  },
  "resolutions": {
    "expo-pixi/@expo/browser-polyfill": "0.0.1-alpha.3"
  },

@TannerAtVenu
Copy link

I'm on expo 37.0.3 and I'm still having this problem.

1 similar comment
@basaksilasanli
Copy link

I'm on expo 37.0.3 and I'm still having this problem.

@ShaneMcNamara
Copy link

ShaneMcNamara commented Dec 16, 2020

FYI, I have looked into the repo, and specifically for the Signature component, the issue can be found in /lib/components/Signature.js#L44.

Looks like the only thing it is doing is forcing a re-render of the child GLView by bumping the key before mounting. I moved the offending code global.__ExpoSignatureId++; into the constructor and removed the componentWillMount call (see React's recommendation.)

This works fine for my app/use case. Your mileage may vary.

It looks like this repo is not actively maintained, so you may want to fork it and make the change yourself.

@Brandonjgs
Copy link

FYI, I have looked into the repo, and specifically for the Signature component, the issue can be found in /lib/components/Signature.js#L44.

Looks like the only thing it is doing is forcing a re-render of the child GLView by bumping the key before mounting. I moved the offending code global.__ExpoSignatureId++; into the constructor and removed the componentWillMount call (see React's recommendation.)

This works fine for my app/use case. Your mileage may vary.

It looks like this repo is not actively maintained, so you may want to fork it and make the change yourself.

This works for me thanks!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants