MCPcopy
hub / github.com/APSL/react-native-keyboard-aware-scroll-view /

Class

lib/KeyboardAwareHOC.js:153–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 return class
154 extends React.Component<KeyboardAwareHOCProps, KeyboardAwareHOCState>
155 implements KeyboardAwareInterface {
156 _rnkasv_keyboardView: any
157 keyboardWillShowEvent: ?Function
158 keyboardWillHideEvent: ?Function
159 position: ContentOffset
160 defaultResetScrollToCoords: ?{ x: number, y: number }
161 mountedComponent: boolean
162 handleOnScroll: Function
163 state: KeyboardAwareHOCState
164 static displayName = `KeyboardAware${getDisplayName(ScrollableComponent)}`
165
166 static propTypes = {
167 viewIsInsideTabBar: PropTypes.bool,
168 resetScrollToCoords: PropTypes.shape({
169 x: PropTypes.number.isRequired,
170 y: PropTypes.number.isRequired
171 }),
172 enableResetScrollToCoords: PropTypes.bool,
173 enableAutomaticScroll: PropTypes.bool,
174 extraHeight: PropTypes.number,
175 extraScrollHeight: PropTypes.number,
176 keyboardOpeningTime: PropTypes.number,
177 onScroll: PropTypes.oneOfType([
178 PropTypes.func, // Normal listener
179 PropTypes.object // Animated.event listener
180 ]),
181 update: PropTypes.func,
182 contentContainerStyle: PropTypes.any,
183 enableOnAndroid: PropTypes.bool,
184 innerRef: PropTypes.func,
185 ...keyboardEventPropTypes
186 }
187
188 // HOC options are used to init default props, so that these options can be overriden with component props
189 static defaultProps = {
190 enableAutomaticScroll: hocOptions.enableAutomaticScroll,
191 extraHeight: hocOptions.extraHeight,
192 extraScrollHeight: hocOptions.extraScrollHeight,
193 enableResetScrollToCoords: hocOptions.enableResetScrollToCoords,
194 keyboardOpeningTime: hocOptions.keyboardOpeningTime,
195 viewIsInsideTabBar: hocOptions.viewIsInsideTabBar,
196 enableOnAndroid: hocOptions.enableOnAndroid
197 }
198
199 constructor(props: KeyboardAwareHOCProps) {
200 super(props)
201 this.keyboardWillShowEvent = undefined
202 this.keyboardWillHideEvent = undefined
203 this.callbacks = {}
204 this.position = { x: 0, y: 0 }
205 this.defaultResetScrollToCoords = null
206 const keyboardSpace: number = props.viewIsInsideTabBar
207 ? _KAM_DEFAULT_TAB_BAR_HEIGHT
208 : 0
209 this.state = { keyboardSpace }
210 }

Callers

nothing calls this directly

Calls 1

getDisplayNameFunction · 0.85

Tested by

no test coverage detected