Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fairchat.ReactNative
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hosting
chat
fairchat.ReactNative
Commits
5b7efc4a
Unverified
Commit
5b7efc4a
authored
7 years ago
by
Diego Sampaio
Browse files
Options
Downloads
Patches
Plain Diff
Proper fix for keyboard
parent
61306131
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/login.js
+2
-2
2 additions, 2 deletions
app/login.js
app/room.js
+19
-13
19 additions, 13 deletions
app/room.js
app/rooms.js
+4
-5
4 additions, 5 deletions
app/rooms.js
app/servers/new.js
+2
-2
2 additions, 2 deletions
app/servers/new.js
with
27 additions
and
22 deletions
app/login.js
+
2
−
2
View file @
5b7efc4a
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
View
,
TextInput
,
StyleSheet
,
KeyboardAvoidingView
}
from
'
react-native
'
;
import
{
View
,
TextInput
,
StyleSheet
,
KeyboardAvoidingView
,
Platform
}
from
'
react-native
'
;
import
realm
from
'
./realm
'
;
import
{
loginWithPassword
,
loadSubscriptions
,
Accounts
}
from
'
./meteor
'
;
...
...
@@ -56,7 +56,7 @@ export default class LoginView extends React.Component {
render
()
{
return
(
<
KeyboardAvoidingView
style
=
{
styles
.
view
}
>
<
KeyboardAvoidingView
style
=
{
styles
.
view
}
behavior
=
{
Platform
.
OS
===
'
ios
'
&&
'
padding
'
}
>
<
TextInput
style
=
{
styles
.
input
}
onChangeText
=
{
username
=>
this
.
setState
({
username
})}
...
...
This diff is collapsed.
Click to expand it.
app/room.js
+
19
−
13
View file @
5b7efc4a
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
View
,
KeyboardAvoidingView
,
Text
,
TextInput
,
FlatList
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
{
View
,
KeyboardAvoidingView
,
Text
,
TextInput
,
FlatList
,
StyleSheet
,
Image
,
Platform
}
from
'
react-native
'
;
// import Markdown from 'react-native-simple-markdown';
import
realm
from
'
./realm
'
;
import
{
loadMessagesForRoom
,
sendMessage
}
from
'
./meteor
'
;
...
...
@@ -67,7 +67,7 @@ class RoomItem extends React.PureComponent {
return
(
<
View
style
=
{[
styles
.
roomItem
,
extraStyle
]}
>
<
Image
style
=
{
styles
.
avatar
}
source
=
{{
uri
:
`
http://localhost:3000
/avatar/
${
this
.
props
.
item
.
u
.
username
}
`
}}
/
>
<
Image
style
=
{
styles
.
avatar
}
source
=
{{
uri
:
`
${
this
.
props
.
baseUrl
}
/avatar/
${
this
.
props
.
item
.
u
.
username
}
`
}}
/
>
<
View
style
=
{
styles
.
texts
}
>
<
Text
onPress
=
{
this
.
_onPress
}
style
=
{
styles
.
username
}
>
{
this
.
props
.
item
.
u
.
username
}
...
...
@@ -98,21 +98,26 @@ export default class RoomView extends React.Component {
this
.
rid
=
realm
.
objectForPrimaryKey
(
'
subscriptions
'
,
props
.
navigation
.
state
.
params
.
sid
).
rid
;
// this.rid = 'GENERAL';
this
.
state
=
this
.
getState
();
this
.
state
=
{
text
:
''
,
dataSource
:
this
.
getMessages
()
};
loadMessagesForRoom
(
this
.
rid
);
this
.
state
=
this
.
getState
();
this
.
url
=
realm
.
objectForPrimaryKey
(
'
settings
'
,
'
Site_Url
'
).
value
;
}
getState
=
()
=>
({
...
this
.
state
,
dataSource
:
realm
.
objects
(
'
messages
'
).
filtered
(
'
rid = $0
'
,
this
.
rid
).
sorted
(
'
ts
'
,
true
)
});
getMessages
=
()
=>
{
return
realm
.
objects
(
'
messages
'
).
filtered
(
'
rid = $0
'
,
this
.
rid
).
sorted
(
'
ts
'
,
true
);
}
updateState
=
()
=>
(
this
.
setState
(
this
.
getState
()))
updateState
=
()
=>
{
this
.
setState
({
dataSource
:
this
.
getMessages
()
});
};
componentDidMount
()
{
componentWillMount
()
{
loadMessagesForRoom
(
this
.
rid
);
realm
.
addListener
(
'
change
'
,
this
.
updateState
);
}
...
...
@@ -124,6 +129,7 @@ export default class RoomView extends React.Component {
<
RoomItem
id
=
{
item
.
_id
}
item
=
{
item
}
baseUrl
=
{
this
.
url
}
/
>
);
...
...
@@ -147,7 +153,7 @@ export default class RoomView extends React.Component {
render
()
{
return
(
<
KeyboardAvoidingView
style
=
{
styles
.
container
}
>
<
KeyboardAvoidingView
style
=
{
styles
.
container
}
behavior
=
{
Platform
.
OS
===
'
ios
'
&&
'
padding
'
}
keyboardVerticalOffset
=
{
64
}
>
<
FlatList
ref
=
{
ref
=>
this
.
listView
=
ref
}
style
=
{
styles
.
list
}
...
...
This diff is collapsed.
Click to expand it.
app/rooms.js
+
4
−
5
View file @
5b7efc4a
...
...
@@ -48,14 +48,13 @@ export default class RoomsView extends React.Component {
constructor
(
props
)
{
super
(
props
);
const
getState
=
()
=>
({
selected
:
new
Map
(),
this
.
state
=
{
dataSource
:
realm
.
objects
(
'
subscriptions
'
).
sorted
(
'
name
'
)
});
};
}
componentWillMount
()
{
realm
.
addListener
(
'
change
'
,
()
=>
this
.
setState
(
getState
()));
this
.
state
=
getState
();
}
_onPressItem
=
(
id
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
app/servers/new.js
+
2
−
2
View file @
5b7efc4a
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
Zeroconf
from
'
react-native-zeroconf
'
;
import
{
View
,
Text
,
TextInput
,
Button
,
StyleSheet
,
KeyboardAvoidingView
}
from
'
react-native
'
;
import
{
View
,
Text
,
TextInput
,
Button
,
StyleSheet
,
KeyboardAvoidingView
,
Platform
}
from
'
react-native
'
;
import
{
NavigationActions
}
from
'
react-navigation
'
import
realm
from
'
../realm
'
;
...
...
@@ -76,7 +76,7 @@ export default class NewServerView extends React.Component {
render
()
{
return
(
<
KeyboardAvoidingView
style
=
{
styles
.
view
}
behavior
=
'
padding
'
>
<
KeyboardAvoidingView
style
=
{
styles
.
view
}
behavior
=
{
Platform
.
OS
===
'
ios
'
&&
'
padding
'
}
>
<
TextInput
style
=
{
styles
.
input
}
onChangeText
=
{
text
=>
this
.
setState
({
text
})}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment