Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
ThaliApp
Commits
dbfb6cb5
Verified
Commit
dbfb6cb5
authored
May 29, 2019
by
Sébastiaan Versteeg
Browse files
Fix i18next-react and iPhone X notch support
parent
4fe269da
Changes
32
Hide whitespace changes
Inline
Side-by-side
android/app/build.gradle
View file @
dbfb6cb5
...
...
@@ -76,6 +76,7 @@ android {
}
dependencies
{
implementation
project
(
':react-native-device-info'
)
implementation
project
(
':react-native-screens'
)
implementation
project
(
':react-native-gesture-handler'
)
implementation
project
(
':react-native-sentry'
)
...
...
android/app/src/main/java/com/thaliapp/MainApplication.java
View file @
dbfb6cb5
...
...
@@ -3,6 +3,7 @@ package com.thaliapp;
import
android.app.Application
;
import
com.facebook.react.ReactApplication
;
import
com.learnium.RNDeviceInfo.RNDeviceInfo
;
import
com.swmansion.rnscreens.RNScreensPackage
;
import
com.swmansion.gesturehandler.react.RNGestureHandlerPackage
;
import
cl.json.ShareApplication
;
...
...
@@ -37,6 +38,7 @@ public class MainApplication extends Application implements ShareApplication, Re
protected
List
<
ReactPackage
>
getPackages
()
{
return
Arrays
.
asList
(
new
MainReactPackage
(),
new
RNDeviceInfo
(),
new
RNScreensPackage
(),
new
RNGestureHandlerPackage
(),
new
RNSharePackage
(),
...
...
android/settings.gradle
View file @
dbfb6cb5
rootProject
.
name
=
'ThaliApp'
include
':react-native-device-info'
project
(
':react-native-device-info'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'../node_modules/react-native-device-info/android'
)
include
':react-native-screens'
project
(
':react-native-screens'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'../node_modules/react-native-screens/android'
)
include
':react-native-gesture-handler'
...
...
app/app.js
View file @
dbfb6cb5
...
...
@@ -4,7 +4,7 @@ import {
}
from
'
react-native
'
;
import
{
applyMiddleware
,
createStore
}
from
'
redux
'
;
import
{
Provider
}
from
'
react-redux
'
;
import
{
I18nextProvider
,
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
I18nextProvider
,
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
createSagaMiddleware
from
'
redux-saga
'
;
import
firebase
from
'
react-native-firebase
'
;
import
locale
from
'
react-native-locale-detector
'
;
...
...
@@ -124,4 +124,4 @@ Main.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
app/App
'
)(
Main
);
export
default
withT
ranslat
ion
(
'
app/App
'
)(
Main
);
app/ui/components/errorScreen/ErrorScreen.js
View file @
dbfb6cb5
import
React
from
'
react
'
;
import
{
Image
,
Text
,
View
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
PropTypes
from
'
prop-types
'
;
import
styles
from
'
./style/ErrorScreen
'
;
...
...
@@ -29,4 +29,4 @@ ErrorScreen.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
components/errorScreen/ErrorScreen
'
)(
ErrorScreen
);
export
default
withT
ranslat
ion
(
'
components/errorScreen/ErrorScreen
'
)(
ErrorScreen
);
app/ui/components/searchHeader/SearchHeader.js
View file @
dbfb6cb5
...
...
@@ -9,6 +9,7 @@ import {
TextInput
,
TouchableOpacity
,
View
,
SafeAreaView
,
}
from
'
react-native
'
;
import
PropTypes
from
'
prop-types
'
;
...
...
@@ -154,17 +155,19 @@ class SearchHeader extends Component {
animated
barStyle
=
{
isSearching
?
'
dark-content
'
:
'
light-content
'
}
/
>
<
View
style
=
{
styles
.
appBar
}
>
{
isAnimating
&&
(
<
Animated
.
View
style
=
{[
styles
.
animationView
,
{
transform
:
[{
scale
:
scaleValue
}]
}]}
/
>
)}
{
this
.
getLeftIcon
()}
{
this
.
getCenter
()}
{
this
.
getRightIcon
()}
<
/View
>
<
SafeAreaView
style
=
{
styles
.
safeArea
}
>
<
View
style
=
{
styles
.
appBar
}
>
{
isAnimating
&&
(
<
Animated
.
View
style
=
{[
styles
.
animationView
,
{
transform
:
[{
scale
:
scaleValue
}]
}]}
/
>
)}
{
this
.
getLeftIcon
()}
{
this
.
getCenter
()}
{
this
.
getRightIcon
()}
<
/View
>
<
/SafeAreaView
>
<
/View
>
);
}
...
...
app/ui/components/searchHeader/style/SearchHeader.js
View file @
dbfb6cb5
import
{
Dimensions
}
from
'
react-native
'
;
import
Colors
from
'
../../../style/Colors
'
;
import
StyleSheet
from
'
../../../style/StyleSheet
'
;
import
Colors
from
'
../../../style/Colors
'
;
import
{
STATUSBAR_HEIGHT
,
APPBAR_HEIGHT
}
from
'
../../standardHeader/style/StandardHeader
'
;
import
{
APPBAR_HEIGHT
,
STATUSBAR_HEIGHT
}
from
'
../../standardHeader/style/StandardHeader
'
;
const
windowWidth
=
Dimensions
.
get
(
'
window
'
).
width
;
const
styles
=
StyleSheet
.
create
({
safeArea
:
{
backgroundColor
:
Colors
.
magenta
,
android
:
{
elevation
:
4
,
},
ios
:
{
borderStyle
:
'
solid
'
,
borderBottomColor
:
Colors
.
darkMagenta
,
borderBottomWidth
:
1
,
},
},
appBar
:
{
backgroundColor
:
Colors
.
magenta
,
height
:
APPBAR_HEIGHT
+
STATUSBAR_HEIGHT
,
paddingTop
:
STATUSBAR_HEIGHT
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
,
flexWrap
:
'
wrap
'
,
flexDirection
:
'
row
'
,
elevation
:
4
,
android
:
{
height
:
APPBAR_HEIGHT
+
STATUSBAR_HEIGHT
,
paddingTop
:
STATUSBAR_HEIGHT
,
},
ios
:
{
height
:
APPBAR_HEIGHT
,
},
},
title
:
{
color
:
Colors
.
white
,
...
...
app/ui/components/sidebar/Sidebar.js
View file @
dbfb6cb5
...
...
@@ -4,7 +4,7 @@ import {
Alert
,
Image
,
ImageBackground
,
Text
,
TouchableHighlight
,
View
,
}
from
'
react-native
'
;
import
LinearGradient
from
'
react-native-linear-gradient
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
Icon
from
'
react-native-vector-icons/MaterialIcons
'
;
import
styles
from
'
./style/Sidebar
'
;
import
Colors
from
'
../../style/Colors
'
;
...
...
@@ -125,4 +125,4 @@ Sidebar.propTypes = {
openMemberList
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
components/sidebar/Sidebar
'
)(
Sidebar
);
export
default
withT
ranslat
ion
(
'
components/sidebar/Sidebar
'
)(
Sidebar
);
app/ui/components/standardHeader/StandardHeader.js
View file @
dbfb6cb5
import
React
from
'
react
'
;
import
{
StatusBar
,
Text
,
TouchableOpacity
,
View
,
StatusBar
,
Text
,
TouchableOpacity
,
View
,
SafeAreaView
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
PropTypes
from
'
prop-types
'
;
import
Icon
from
'
react-native-vector-icons/MaterialIcons
'
;
...
...
@@ -43,24 +43,26 @@ const StandardHeader = props => (
barStyle
=
"
light-content
"
/>
<
/View
>
<
View
style
=
{
styles
.
appBar
}
>
<
TouchableOpacity
style
=
{
styles
.
iconButton
}
onPress
=
{()
=>
(
props
.
menu
?
props
.
navigation
.
toggleDrawer
()
:
props
.
navigation
.
goBack
())}
>
<
Icon
name
=
{
props
.
menu
?
'
menu
'
:
'
arrow-back
'
}
style
=
{
styles
.
icon
}
size
=
{
24
}
/
>
<
/TouchableOpacity
>
<
Text
style
=
{
styles
.
title
}
>
{
sceneToTitle
(
props
.
navigation
.
state
.
routeName
,
props
.
t
)}
<
/Text
>
<
View
style
=
{
styles
.
rightView
}
>
{
props
.
rightView
}
<
SafeAreaView
style
=
{
styles
.
safeArea
}
>
<
View
style
=
{
styles
.
appBar
}
>
<
TouchableOpacity
style
=
{
styles
.
iconButton
}
onPress
=
{()
=>
(
props
.
menu
?
props
.
navigation
.
toggleDrawer
()
:
props
.
navigation
.
goBack
())}
>
<
Icon
name
=
{
props
.
menu
?
'
menu
'
:
'
arrow-back
'
}
style
=
{
styles
.
icon
}
size
=
{
24
}
/
>
<
/TouchableOpacity
>
<
Text
style
=
{
styles
.
title
}
>
{
sceneToTitle
(
props
.
navigation
.
state
.
routeName
,
props
.
t
)}
<
/Text
>
<
View
style
=
{
styles
.
rightView
}
>
{
props
.
rightView
}
<
/View
>
<
/View
>
<
/View
>
<
/
SafeArea
View
>
<
/View
>
);
...
...
@@ -76,7 +78,7 @@ StandardHeader.defaultProps = {
menu
:
false
,
};
const
StandardHeaderContainer
=
withNavigation
(
t
ranslat
e
(
'
components/standardHeader/StandardHeader
'
)(
StandardHeader
));
const
StandardHeaderContainer
=
withNavigation
(
withT
ranslat
ion
(
'
components/standardHeader/StandardHeader
'
)(
StandardHeader
));
export
default
StandardHeaderContainer
;
export
function
withStandardHeader
(
Component
,
menu
)
{
...
...
app/ui/components/standardHeader/style/StandardHeader.js
View file @
dbfb6cb5
import
{
Platform
,
StatusBar
}
from
'
react-native
'
;
import
DeviceInfo
from
'
react-native-device-info
'
;
import
StyleSheet
from
'
../../../style/StyleSheet
'
;
import
Colors
from
'
../../../style/Colors
'
;
export
const
STATUSBAR_HEIGHT
=
Platform
.
OS
===
'
ios
'
?
20
:
StatusBar
.
currentHeight
;
// eslint-disable-next-line no-nested-ternary
export
const
STATUSBAR_HEIGHT
=
Platform
.
OS
===
'
ios
'
?
DeviceInfo
.
hasNotch
()
?
44
:
20
:
StatusBar
.
currentHeight
;
export
const
APPBAR_HEIGHT
=
Platform
.
OS
===
'
ios
'
?
44
:
56
;
export
const
TOTAL_BAR_HEIGHT
=
APPBAR_HEIGHT
+
STATUSBAR_HEIGHT
;
...
...
@@ -19,13 +23,8 @@ const styles = StyleSheet.create({
elevation
:
4
,
},
},
appBar
:
{
safeArea
:
{
backgroundColor
:
Colors
.
magenta
,
height
:
APPBAR_HEIGHT
,
flexDirection
:
'
row
'
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
,
flexWrap
:
'
wrap
'
,
android
:
{
height
:
APPBAR_HEIGHT
,
elevation
:
4
,
...
...
@@ -36,6 +35,14 @@ const styles = StyleSheet.create({
borderBottomWidth
:
1
,
},
},
appBar
:
{
backgroundColor
:
Colors
.
magenta
,
height
:
APPBAR_HEIGHT
,
flexDirection
:
'
row
'
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
,
flexWrap
:
'
wrap
'
,
},
title
:
{
color
:
Colors
.
white
,
android
:
{
...
...
app/ui/screens/events/CalendarItem.js
View file @
dbfb6cb5
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
Text
,
TouchableHighlight
,
View
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
Moment
from
'
moment
'
;
import
styles
from
'
./style/CalendarItem
'
;
...
...
@@ -57,4 +57,4 @@ CalendarItem.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screen/events/CalendarItem
'
)(
CalendarItem
);
export
default
withT
ranslat
ion
(
'
screen/events/CalendarItem
'
)(
CalendarItem
);
app/ui/screens/events/CalendarScreen.js
View file @
dbfb6cb5
...
...
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import
{
RefreshControl
,
ScrollView
,
SectionList
,
Text
,
View
,
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
Moment
from
'
moment
'
;
import
locale
from
'
react-native-locale-detector
'
;
import
CalendarItem
from
'
./CalendarItemConnector
'
;
...
...
@@ -205,4 +205,4 @@ CalendarScreen.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/events/CalendarScreen
'
)(
withStandardHeader
(
CalendarScreen
,
true
));
export
default
withT
ranslat
ion
(
'
screens/events/CalendarScreen
'
)(
withStandardHeader
(
CalendarScreen
,
true
));
app/ui/screens/events/EventAdminScreen.js
View file @
dbfb6cb5
...
...
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import
{
View
,
Text
,
Switch
,
RefreshControl
,
ScrollView
,
FlatList
,
TouchableHighlight
,
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
PropTypes
from
'
prop-types
'
;
import
Icon
from
'
react-native-vector-icons/MaterialIcons
'
;
import
Snackbar
from
'
react-native-snackbar
'
;
...
...
@@ -340,4 +340,4 @@ EventAdminScreen.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/events/EventAdminScreen
'
)(
EventAdminScreen
);
export
default
withT
ranslat
ion
(
'
screens/events/EventAdminScreen
'
)(
EventAdminScreen
);
app/ui/screens/events/EventScreen.js
View file @
dbfb6cb5
...
...
@@ -11,7 +11,7 @@ import {
TouchableOpacity
,
View
,
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
Moment
from
'
moment
'
;
import
HTML
from
'
react-native-render-html
'
;
import
Share
from
'
react-native-share
'
;
...
...
@@ -556,4 +556,4 @@ EventScreen.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/events/EventScreen
'
)(
EventScreen
);
export
default
withT
ranslat
ion
(
'
screens/events/EventScreen
'
)(
EventScreen
);
app/ui/screens/events/RegistrationScreen.js
View file @
dbfb6cb5
...
...
@@ -9,7 +9,7 @@ import {
TextInput
,
View
,
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
PropTypes
from
'
prop-types
'
;
import
HTML
from
'
react-native-render-html
'
;
...
...
@@ -218,4 +218,4 @@ RegistrationScreen.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/events/RegistrationScreen
'
)(
withStandardHeader
(
RegistrationScreen
));
export
default
withT
ranslat
ion
(
'
screens/events/RegistrationScreen
'
)(
withStandardHeader
(
RegistrationScreen
));
app/ui/screens/login/LoginScreen.js
View file @
dbfb6cb5
...
...
@@ -9,7 +9,7 @@ import {
TextInput
,
View
,
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
{
url
}
from
'
../../../utils/url
'
;
import
DismissKeyboardView
from
'
../../components/dismissKeyboardView/DismissKeyboardView
'
;
import
Button
from
'
../../components/button/Button
'
;
...
...
@@ -119,4 +119,4 @@ LoginScreen.propTypes = {
status
:
PropTypes
.
string
.
isRequired
,
};
export
default
t
ranslat
e
([
'
screens/user/LoginScreen
'
])(
LoginScreen
);
export
default
withT
ranslat
ion
([
'
screens/user/LoginScreen
'
])(
LoginScreen
);
app/ui/screens/memberList/MemberListScreen.js
View file @
dbfb6cb5
import
React
,
{
Component
}
from
'
react
'
;
import
{
FlatList
,
View
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
PropTypes
from
'
prop-types
'
;
import
MemberView
from
'
../../components/memberView/MemberViewConnector
'
;
...
...
@@ -115,4 +115,4 @@ MemberListScreen.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/memberList/MemberListScreen
'
)(
MemberListScreen
);
export
default
withT
ranslat
ion
(
'
screens/memberList/MemberListScreen
'
)(
MemberListScreen
);
app/ui/screens/pizza/PizzaScreen.js
View file @
dbfb6cb5
...
...
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import
{
RefreshControl
,
ScrollView
,
Text
,
TouchableHighlight
,
View
,
}
from
'
react-native
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
Icon
from
'
react-native-vector-icons/MaterialIcons
'
;
import
Moment
from
'
moment
'
;
import
LoadingScreen
from
'
../../components/loadingScreen/LoadingScreen
'
;
...
...
@@ -277,4 +277,4 @@ PizzaScreen.defaultProps = {
order
:
null
,
};
export
default
t
ranslat
e
(
'
screens/pizza/PizzaScreen
'
)(
withStandardHeader
(
PizzaScreen
));
export
default
withT
ranslat
ion
(
'
screens/pizza/PizzaScreen
'
)(
withStandardHeader
(
PizzaScreen
));
app/ui/screens/profile/AchievementSection.js
View file @
dbfb6cb5
import
PropTypes
from
'
prop-types
'
;
import
React
from
'
react
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
{
Text
,
View
}
from
'
react-native
'
;
import
Moment
from
'
moment
'
;
import
CardSection
from
'
../../components/cardSection/CardSection
'
;
...
...
@@ -73,4 +73,4 @@ AchievementSection.propTypes = {
type
:
PropTypes
.
string
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/profile/AchievementSection
'
)(
AchievementSection
);
export
default
withT
ranslat
ion
(
'
screens/profile/AchievementSection
'
)(
AchievementSection
);
app/ui/screens/profile/DescriptionSection.js
View file @
dbfb6cb5
import
PropTypes
from
'
prop-types
'
;
import
React
from
'
react
'
;
import
{
t
ranslat
e
}
from
'
react-i18next
'
;
import
{
withT
ranslat
ion
}
from
'
react-i18next
'
;
import
{
Text
}
from
'
react-native
'
;
import
CardSection
from
'
../../components/cardSection/CardSection
'
;
import
styles
from
'
./style/Profile
'
;
...
...
@@ -31,4 +31,4 @@ DescriptionSection.propTypes = {
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
t
ranslat
e
(
'
screens/profile/DescriptionSection
'
)(
DescriptionSection
);
export
default
withT
ranslat
ion
(
'
screens/profile/DescriptionSection
'
)(
DescriptionSection
);
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment