This repository has been archived by the owner on May 7, 2022. It is now read-only.
generated from demchenkoalex/react-native-module-template
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Optimize rerenders * Move panHandlers to the library
- Loading branch information
1 parent
c01a340
commit b3c6898
Showing
5 changed files
with
108 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
{ | ||
"name": "@flyerhq/react-native-keyboard-accessory-view", | ||
"version": "1.6.0", | ||
"version": "2.0.0", | ||
"description": "Keyboard accessory (sticky) view for your React Native app. Supports interactive dismiss on iOS.", | ||
"homepage": "https://github.com/flyerhq/react-native-keyboard-accessory-view#readme", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"author": "Oleksandr Demchenko <[email protected]>", | ||
"contributors": [ | ||
"Vitalii Danylov <[email protected]>" | ||
], | ||
"license": "MIT", | ||
"keywords": [ | ||
"keyboard-accessory", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,30 @@ | ||
import { act, render } from '@testing-library/react-native' | ||
import React from 'react' | ||
import { NativeEventEmitter } from 'react-native' | ||
import { NativeEventEmitter, ScrollView } from 'react-native' | ||
import { keyboardOpenEvent } from '../../jest/fixtures' | ||
import { KeyboardAccessoryView } from '../KeyboardAccessoryView' | ||
|
||
const emitter = new NativeEventEmitter() | ||
|
||
describe('keyboard accessory view', () => { | ||
it('sticks to the bottom with a closed keyboard', () => { | ||
expect.assertions(2) | ||
const handleContentBottomInsetUpdate = jest.fn() | ||
expect.assertions(1) | ||
const { getByTestId } = render( | ||
<KeyboardAccessoryView | ||
onContentBottomInsetUpdate={handleContentBottomInsetUpdate} | ||
/> | ||
<KeyboardAccessoryView renderScrollable={() => <ScrollView />} /> | ||
) | ||
const container = getByTestId('container') | ||
expect(container.props.style).toHaveProperty('bottom', 0) | ||
expect(handleContentBottomInsetUpdate).toHaveBeenLastCalledWith(0) | ||
}) | ||
|
||
it('sticks to the keyboard top with an open keyboard', () => { | ||
expect.assertions(2) | ||
const handleContentBottomInsetUpdate = jest.fn() | ||
expect.assertions(1) | ||
const { getByTestId } = render( | ||
<KeyboardAccessoryView | ||
onContentBottomInsetUpdate={handleContentBottomInsetUpdate} | ||
/> | ||
<KeyboardAccessoryView renderScrollable={() => <ScrollView />} /> | ||
) | ||
act(() => { | ||
emitter.emit('keyboardWillChangeFrame', keyboardOpenEvent) | ||
}) | ||
const container = getByTestId('container') | ||
expect(container.props.style).toHaveProperty('bottom', 346) | ||
expect(handleContentBottomInsetUpdate).toHaveBeenLastCalledWith(312) | ||
}) | ||
}) |