React-native-keyboard-aware-scroll-view: Are the Flow types completely broken in this repo?

Created on 27 Feb 2018  路  4Comments  路  Source: APSL/react-native-keyboard-aware-scroll-view

Hey there,

I installed this project and ran flow and got a ton of errors:

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:39
 39: function listenToKeyboardEvents(ScrollableComponent: React$Component) {
                                                          ^^^^^^^^^^^^^^^ React.Component. Application of polymorphic type needs <list of 1-2 arguments>. (Can use `*` for inferrable ones)

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:96
                                          v--------------------
 96:         this.keyboardWillShowEvent = Keyboard.addListener(
 97:           'keyboardWillShow',
 98:           this._updateKeyboardSpace
 99:         )
             ^ EmitterSubscription. This type is incompatible with
 96:         this.keyboardWillShowEvent = Keyboard.addListener(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
  Callable property is incompatible:
     45:     keyboardWillShowEvent: ?Function
                                     ^^^^^^^^ function type. Callable signature not found in
                                              v--------------------
     96:         this.keyboardWillShowEvent = Keyboard.addListener(
     97:           'keyboardWillShow',
     98:           this._updateKeyboardSpace
     99:         )
                 ^ EmitterSubscription

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:100
                                          v--------------------
100:         this.keyboardWillHideEvent = Keyboard.addListener(
101:           'keyboardWillHide',
102:           this._resetKeyboardSpace
103:         )
             ^ EmitterSubscription. This type is incompatible with
100:         this.keyboardWillHideEvent = Keyboard.addListener(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
  Callable property is incompatible:
     46:     keyboardWillHideEvent: ?Function
                                     ^^^^^^^^ function type. Callable signature not found in
                                              v--------------------
    100:         this.keyboardWillHideEvent = Keyboard.addListener(
    101:           'keyboardWillHide',
    102:           this._resetKeyboardSpace
    103:         )
                 ^ EmitterSubscription

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:105
                                          v--------------------
105:         this.keyboardWillShowEvent = Keyboard.addListener(
106:           'keyboardDidShow',
107:           this._updateKeyboardSpace
108:         )
             ^ EmitterSubscription. This type is incompatible with
105:         this.keyboardWillShowEvent = Keyboard.addListener(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
  Callable property is incompatible:
     45:     keyboardWillShowEvent: ?Function
                                     ^^^^^^^^ function type. Callable signature not found in
                                              v--------------------
    105:         this.keyboardWillShowEvent = Keyboard.addListener(
    106:           'keyboardDidShow',
    107:           this._updateKeyboardSpace
    108:         )
                 ^ EmitterSubscription

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:109
                                          v--------------------
109:         this.keyboardWillHideEvent = Keyboard.addListener(
110:           'keyboardDidHide',
111:           this._resetKeyboardSpace
112:         )
             ^ EmitterSubscription. This type is incompatible with
109:         this.keyboardWillHideEvent = Keyboard.addListener(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
  Callable property is incompatible:
     46:     keyboardWillHideEvent: ?Function
                                     ^^^^^^^^ function type. Callable signature not found in
                                              v--------------------
    109:         this.keyboardWillHideEvent = Keyboard.addListener(
    110:           'keyboardDidHide',
    111:           this._resetKeyboardSpace
    112:         )
                 ^ EmitterSubscription

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:289
289:         reactNode,
             ^^^^^^^^^ null or undefined. This type is incompatible with the expected param type of
  9:     reactNode: Object,
                    ^^^^^^ object type. See: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareInterface.js:9

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:289
289:         reactNode,
             ^^^^^^^^^ number. This type is incompatible with the expected param type of
  9:     reactNode: Object,
                    ^^^^^^ object type. See: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareInterface.js:9

Error: node_modules/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js:300
300:       this.position = e.nativeEvent.contentOffset
                                         ^^^^^^^^^^^^^ property `contentOffset`. Property not found in
300:       this.position = e.nativeEvent.contentOffset
                           ^^^^^^^^^^^^^ Event

I tried to just check out the repository and fix the errors, but running flow from a fresh checkout (git clone and yarn and yarn flow in that order) cough up ~1000 Flow errors.

Are the type annotations broken? Is there a Flow version issue?

Most helpful comment

Hi @nojasne!

I didn't have time to address this yet, but expect updates next week, my team is currently working on this.

All 4 comments

Any update/solution to this problem with flow?

Hi @nojasne!

I didn't have time to address this yet, but expect updates next week, my team is currently working on this.

@alvaromb any informations about a eventual resolution? Thank you

Was this page helpful?
0 / 5 - 0 ratings