Skip to content

Commit

Permalink
fix: Mousetrap import on mobile and inner text element in headers
Browse files Browse the repository at this point in the history
  • Loading branch information
glouvigny committed Mar 14, 2019
1 parent 58d2796 commit 0cadf69
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 1,085 deletions.
2 changes: 1 addition & 1 deletion client/react-native/common/components/App.js
Expand Up @@ -17,7 +17,7 @@ import { AppNavigator } from './Navigator/AppNavigator'
import { RelayContext } from '../relay'
import { UpdateContext } from '../update'
import * as KeyboardContext from '../helpers/KeyboardContext'
import Mousetrap from 'mousetrap'
import Mousetrap from '../helpers/Mousetrap'

const { CoreModule } = NativeModules

Expand Down
24 changes: 13 additions & 11 deletions client/react-native/common/components/Library/Header.js
Expand Up @@ -71,17 +71,19 @@ class Header extends PureComponent {
middle
/>
)}
<Text
icon={titleIcon}
left
large
color={colorText}
justify={backBtn ? 'center' : 'start'}
middle
size={5}
>
{title}
</Text>
{typeof title !== 'string'
? title
: <Text
icon={titleIcon}
left
large
color={colorText}
justify={backBtn ? 'center' : 'start'}
middle
size={5}
>
{title}
</Text>}
{rightBtn ? <View>{rightBtn}</View> : null}
{!rightBtn &&
rightBtnIcon !== null && (
Expand Down
4 changes: 3 additions & 1 deletion client/react-native/common/components/Library/ModalScreen.js
Expand Up @@ -21,7 +21,9 @@ class ModalScreen extends React.PureComponent {
}

componentWillUnmount () {
window.removeEventListener('keyup', this._keyboardListener)
if (Platform.OS === 'web') {
window.removeEventListener('keyup', this._keyboardListener)
}
}

keyboardListener (event) {
Expand Down
Expand Up @@ -10,7 +10,7 @@ import { Pagination } from '../../../relay'
import { fragments } from '../../../graphql'
import { borderTop, marginLeft, padding } from '../../../styles'
import { conversation as utils } from '../../../utils'
import Mousetrap from 'mousetrap'
import Mousetrap from '../../../helpers/Mousetrap'
import { withGoBack } from '../../Library/BackActionProvider'
import { withNavigation, withNavigationFocus, StackActions, NavigationActions } from 'react-navigation'

Expand Down
1 change: 1 addition & 0 deletions client/react-native/common/helpers/Mousetrap.js
@@ -0,0 +1 @@
export default {}
2 changes: 2 additions & 0 deletions client/react-native/common/helpers/Mousetrap.web.js
@@ -0,0 +1,2 @@
import Mousetrap from 'mousetrap'
export default Mousetrap
1,145 changes: 74 additions & 1,071 deletions client/react-native/yarn.lock

Large diffs are not rendered by default.

0 comments on commit 0cadf69

Please sign in to comment.