react-native-keyboard-aware-scroll-view icon indicating copy to clipboard operation
react-native-keyboard-aware-scroll-view copied to clipboard

Flow erros

Open ishigamii opened this issue 7 years ago • 11 comments

Hi, since I updated to the latest version I am having lots of flow errors considering this lib :

hope this issue wasn't already known.

[flow] Cannot create `KeyboardAwareScrollView` element because a callable signature is missing in props [1] but exists in function type [2]. (References: [1] [2])
[flow] Cannot instantiate `React.Element` because in type argument `ElementType`: Either inexact statics of `<<anonymous class>>` [1] is incompatible with exact `React.Element` [2] in the return value. Or statics of `<<anonymous class>>` [1] is incompatible with `React.Portal` [3] in the return value. Or property `@@iterator` is missing in statics of `<<anonymous class>>` [1] but exists in `$Iterable` [4] in the return value. Or function [5] is incompatible with statics of `React.Component` [6]. (References: [1] [2] [3] [4] [5] [6])
[flow] all branches are incompatible: Either inexact statics of `<<anonymous class>>` [1] is incompatible with exact `React.Element` [2]. Or statics of `<<anonymous class>>` [1] is incompatible with `React.Portal` [3]. Or property `@@iterator` is missing in statics of `<<anonymous class>>` [1] but exists in `$Iterable` [4]. (References: [1] [2] [3] [4])

I am using :

    "debounce": "^1.1.0",
    "lodash": "^4.17.10",
    "lottie-react-native": "^2.5.8",
    "moment": "^2.20.1",
    "moment-timezone": "^0.5.14",
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-keyboard-aware-scroll-view": "^0.7.3",
    "react-navigation": "^2.17.0",
    ....

For the moment I avoided the problem with ignoring it like explained here :

https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/117

Thanks a lot.

ishigamii avatar Oct 17 '18 11:10 ishigamii

Can you send a PR with the Flow fixes? Thanks.

alvaromb avatar Oct 18 '18 05:10 alvaromb

I would love to though adding an ignore isn't a valid correction and I don't know how to make a better way for the moment ;)

ishigamii avatar Oct 18 '18 08:10 ishigamii

@MounirDhahri it is what I already did it was in the link and in my comment ;) Though it "works" I get another warning

ishigamii avatar Nov 19 '18 16:11 ishigamii

I have the flow issue thing in my roadmap for this week. Sorry guys, I'm running too much OSS stuff myself alone atm.

alvaromb avatar Nov 19 '18 16:11 alvaromb

Just FYI, we're experiencing the flow issues and the fix is almost 50% already done, but priorities come first.

alvaromb avatar Nov 19 '18 16:11 alvaromb

@alvaromb thanks for the update on this case that's nice to hear :) 👍

ishigamii avatar Nov 19 '18 16:11 ishigamii

Working on this right now https://github.com/APSL/react-native-keyboard-aware-scroll-view/tree/flow-issues

Please test this branch with flow WIP

alvaromb avatar Dec 10 '18 14:12 alvaromb

@alvaromb That branch is a lot better (3 errors vs 30) for my project. At the moment I just added // $FlowFixMe comments to those three lines to clear the rest of the errors out and everything's working.

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:385:49

Cannot get TextInput.State because property State is missing in statics of InternalTextInputType [1].

     node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js
      382│           keyboardSpace -= _KAM_DEFAULT_TAB_BAR_HEIGHT
      383│         }
      384│         this.setState({ keyboardSpace })
      385│         const currentlyFocusedField = TextInput.State.currentlyFocusedField()
      386│         const responder = this.getScrollResponder()
      387│         if (!currentlyFocusedField || !responder) {
      388│           return

     node_modules/react-native/Libraries/Components/TextInput/TextInput.js
 [1] 1205│ class InternalTextInputType extends ReactNative.NativeComponent<Props> {
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:477:11

Cannot call this.scrollToFocusedInput with reactNode bound to reactNode because number [1] is incompatible with object
type [2].

     node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js
     474│       const reactNode = ReactNative.findNodeHandle(nodeID)
     475│       if (reactNode) {
     476│         this.scrollToFocusedInput(
     477│           reactNode,
     478│           extra + this.props.extraScrollHeight,
     479│           keyboardOpeningTime !== undefined
     480│             ? keyboardOpeningTime

     node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareInterface.js
 [2]   9│     reactNode: Object,

     node_modules/react-native/Libraries/Renderer/shims/ReactNativeTypes.js
 [1] 133│   findNodeHandle(componentOrHandle: any): ?number,

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:500:47

Cannot get TextInput.State because property State is missing in statics of InternalTextInputType [1].

     node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js
      497│     }
      498│
      499│     update = () => {
      500│       const currentlyFocusedField = TextInput.State.currentlyFocusedField()
      501│       const responder = this.getScrollResponder()
      502│       if (!currentlyFocusedField || !responder) {
      503│         return

     node_modules/react-native/Libraries/Components/TextInput/TextInput.js
 [1] 1205│ class InternalTextInputType extends ReactNative.NativeComponent<Props> {

Christopotamus avatar Jan 22 '19 01:01 Christopotamus

If you ignore the entire module in .flowconfig you'll get different warnings. But so far I've had luck with ignoring on the one file, so add this be ignored to .flowconfig <PROJECT_ROOT>/node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js

mikeislearning avatar Jun 01 '19 22:06 mikeislearning

As a workaround while this is still open, I used a slightly different approach to the [ignore] because that will give cannot resolve module errors when linting with flow. Instead I used [untyped] in .flowconfig:

[untyped]
; https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/315
<PROJECT_ROOT>/node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js

LordParsley avatar Jan 16 '20 15:01 LordParsley

I've this error error node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js: #<WeakSet> could not be cloned.

Rananjaya avatar Apr 23 '21 11:04 Rananjaya