"LikeView" does not have propType "RCTFBLikeView.onLayout" of its own type "boolean" unless you change this

LikeView does not have propType for native prop RCTFBLikeView.onLayout its own boolean type. If you have not changed this setting yourself, this usually means that your versions of native code and JavaScript code are not synchronized. Updating both should cause this error to disappear. enter image description here

I don’t know why I get this error. I don’t use LikeView in the Android app at all. I tried to run npm start --reset-cache .

Also, the iOS version for the application does not cause problems. This only happens for Android.

Any suggestions are welcome.

Thanks!

+5
source share
4 answers

I realized that the problem is (as RN points out) the mismatch between the native details and the JS on the details that each view uses. Namely:

  • renderToHardwareTextureAndroid
  • Onlayout
  • accessibilityLiveRegion
  • accessibilityComponentType
  • importantForAccessibility
  • accessibilityLabel
  • Testid

Since I do not use any of the types that the package uses, namely:

  • Fblikeview
  • FBLoginButton
  • FBSendButton
  • FBShareButton

I tried to set this props as "native", so that they are not tied to the JavaScript side. In each component (in the FBShareButton.js example), I replaced:

 const RCTFBShareButton = requireNativeComponent( 'RCTFBShareButton', ShareButton, ); 

with

 const RCTFBShareButton = requireNativeComponent( 'RCTFBShareButton', ShareButton, { nativeOnly: { onChange: true, onLayout: true, testID: true, importantForAccessibility: true, accessibilityLiveRegion: true, accessibilityComponentType: true, accessibilityLabel: true, renderToHardwareTextureAndroid: true, } }, ); 

Now I'm going to check if the views are displayed correctly and edit my post later, but if you just want to compile your application to continue development (since this is my case at the moment), this should allow you to do this.

Edit

I successfully executed the LoginButton component using an example in README with my changes.

Edit 2

I made a transfer request with my changes in the package. I don’t like the solution, but it can get FB’s attention. In the meantime, you can just use your plug. In package.json simply replace the fbsdk line as follows:

"react-native-fbsdk": "git+https://github.com/motius/react-native-fbsdk.git#fix-views"

This other pull request might be the best solution actually.

+4
source

Similar to the solution proposed by @martinarroyo, I decided that it is associated with some components that do not synchronize between native code and js code. If you are not using these components, instead of adding the nativeOnly property to every js file you use, I commented on the export from response-native-fbsdk index.js file as follows:

 //native components // exports.LikeView = require('./FBLikeView'); // exports.LoginButton = require('./FBLoginButton'); // exports.SendButton = require('./FBSendButton'); // exports.ShareButton = require('./FBShareButton'); 

Obviously, this is just a workaround, but this should help you overcome this error.

+4
source

You can downgrade action-native-fbsdk to 0.5.1 to avoid this problem until the patch is merged into a new version.

+1
source

So, after countless experiments and a blow to the head, I think the solution was a dependency version.

Here is a list of the things I tried, and the one that, it seems to me, solved the problem is marked *, because I am not 100% sure if this step resolved it.

  • delete the node_modules folder and reinstall it.
  • Doing action-native- git -upgrade as suggested by @matt
  • re-install response-native-fbsdk as instructed and double-check the code.
  • change buildToolsVersion and targetSdkVersion to 25.5 **. ultimately, react-native uninstall react-native-fbsdk , followed by react-native install react-native-fbsdk@0.5.0 .

Note * The number 5 has been taken over the past two days ... but only now it has worked ... Therefore, I do not know what black magic is that made it work just now ...

The problem with number 5 is that until yesterday the version of the fbsdk dependency was 0.5.0, and as of yesterday it was updated to 0.6. So I'm not sure why, although I reinstalled it yesterday, it didn’t fix the error.

If someone who is more familiar with this can explain why this happened, I would be inclined to learn.

0
source

Source: https://habr.com/ru/post/1268145/


All Articles