[APP-735] Post language improvements (#982)
* Fix composer character-counter bouncing around UI elements * Fix composer toolbar padding when keyboard is dismissed on iOS * Use the full name of the language in the composer footer * Add headings to the DropdownButton * Update the composer language control to use a simpler dropdown * Fix lint * Add translate link to Post component used in notifications * Fix lint
This commit is contained in:
parent
f05c2f06d6
commit
e14c9783e0
11 changed files with 189 additions and 28 deletions
35
src/lib/hooks/useIsKeyboardVisible.ts
Normal file
35
src/lib/hooks/useIsKeyboardVisible.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import {useState, useEffect} from 'react'
|
||||
import {Keyboard} from 'react-native'
|
||||
import {isIOS} from 'platform/detection'
|
||||
|
||||
export function useIsKeyboardVisible({
|
||||
iosUseWillEvents,
|
||||
}: {
|
||||
iosUseWillEvents?: boolean
|
||||
} = {}) {
|
||||
const [isKeyboardVisible, setKeyboardVisible] = useState(false)
|
||||
|
||||
// NOTE
|
||||
// only iOS suppose the "will" events
|
||||
// -prf
|
||||
const showEvent =
|
||||
isIOS && iosUseWillEvents ? 'keyboardWillShow' : 'keyboardDidShow'
|
||||
const hideEvent =
|
||||
isIOS && iosUseWillEvents ? 'keyboardWillHide' : 'keyboardDidHide'
|
||||
|
||||
useEffect(() => {
|
||||
const keyboardShowListener = Keyboard.addListener(showEvent, () =>
|
||||
setKeyboardVisible(true),
|
||||
)
|
||||
const keyboardHideListener = Keyboard.addListener(hideEvent, () =>
|
||||
setKeyboardVisible(false),
|
||||
)
|
||||
|
||||
return () => {
|
||||
keyboardHideListener.remove()
|
||||
keyboardShowListener.remove()
|
||||
}
|
||||
}, [showEvent, hideEvent])
|
||||
|
||||
return [isKeyboardVisible]
|
||||
}
|
|
@ -89,6 +89,9 @@ export const s = StyleSheet.create({
|
|||
// text decoration
|
||||
underline: {textDecorationLine: 'underline'},
|
||||
|
||||
// font variants
|
||||
tabularNum: {fontVariant: ['tabular-nums']},
|
||||
|
||||
// font sizes
|
||||
f9: {fontSize: 9},
|
||||
f10: {fontSize: 10},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue