[FIX] Fix null native Messagebox component object (#680)
* Fix null native Messagebox component object * [iOS] Fix header alignment * Remove unused files
This commit is contained in:
parent
62e2d8e7df
commit
eb4b1553bf
45
.flowconfig
45
.flowconfig
|
@ -1,45 +0,0 @@
|
|||
[ignore]
|
||||
; We fork some components by platform
|
||||
.*/*[.]android.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
|
||||
; Ignore unexpected extra "@providesModule"
|
||||
.*/node_modules/.*/node_modules/fbjs/.*
|
||||
|
||||
; Ignore duplicate module providers
|
||||
; For RN Apps installed via npm, "Libraries" folder is inside
|
||||
; "node_modules/react-native" but in the source repo it is in the root
|
||||
.*/Libraries/react-native/React.js
|
||||
.*/Libraries/react-native/ReactNative.js
|
||||
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
node_modules/react-native/Libraries/react-native/react-native-interface.js
|
||||
node_modules/react-native/flow
|
||||
flow/
|
||||
|
||||
[options]
|
||||
emoji=true
|
||||
|
||||
module.system=haste
|
||||
|
||||
munge_underscores=true
|
||||
|
||||
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
|
||||
|
||||
suppress_type=$FlowIssue
|
||||
suppress_type=$FlowFixMe
|
||||
suppress_type=$FixMe
|
||||
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
||||
|
||||
unsafe.enable_getters_and_setters=true
|
||||
|
||||
[version]
|
||||
^0.49.1
|
48
.travis.yml
48
.travis.yml
|
@ -1,48 +0,0 @@
|
|||
branches:
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
- "/^\\d+\\.\\d+\\.\\d+(-rc\\.\\d+)?$/"
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
sudo: false
|
||||
language: android
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_985c748be78d_key -iv $encrypted_985c748be78d_iv -in key.keystore.enc -out android/app/key.keystore -d
|
||||
|
||||
- mkdir -p ~/.gradle
|
||||
- echo -e "ROCKETCHAT_RN_RELEASE_STORE_FILE=$ROCKETCHAT_RN_RELEASE_STORE_FILE" > ~/.gradle/gradle.properties
|
||||
- echo -e "ROCKETCHAT_RN_RELEASE_STORE_PASSWORD=$ROCKETCHAT_RN_RELEASE_STORE_PASSWORD" >> ~/.gradle/gradle.properties
|
||||
- echo -e "ROCKETCHAT_RN_RELEASE_KEY_ALIAS=$ROCKETCHAT_RN_RELEASE_KEY_ALIAS" >> ~/.gradle/gradle.properties
|
||||
- echo -e "ROCKETCHAT_RN_RELEASE_KEY_PASSWORD=$ROCKETCHAT_RN_RELEASE_KEY_PASSWORD" >> ~/.gradle/gradle.properties
|
||||
- nvm install 8
|
||||
- node --version
|
||||
install:
|
||||
- npm install -g codecov
|
||||
- npm install
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- build-tools-23.0.1
|
||||
- build-tools-25.0.1
|
||||
- build-tools-26.0.1
|
||||
- android-23
|
||||
- android-25
|
||||
- android-26
|
||||
- extra-android-m2repository
|
||||
- extra-google-google_play_services
|
||||
- extra-google-m2repository
|
||||
- addon-google_apis-google-16
|
||||
script:
|
||||
- npm run ci
|
||||
- cd android && ./gradlew assembleRelease
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode8.3
|
||||
language: node_js
|
||||
node_js: 8
|
||||
script:
|
||||
- npm run ci
|
|
@ -113,9 +113,9 @@ export default class MessageBox extends Component {
|
|||
const { message, replyMessage } = this.props;
|
||||
if (message !== nextProps.message && nextProps.message.msg) {
|
||||
this.setInput(nextProps.message.msg);
|
||||
this.component.focus();
|
||||
this.focus();
|
||||
} else if (replyMessage !== nextProps.replyMessage && nextProps.replyMessage.msg) {
|
||||
this.component.focus();
|
||||
this.focus();
|
||||
} else if (!nextProps.message) {
|
||||
this.clearInput();
|
||||
}
|
||||
|
@ -169,18 +169,20 @@ export default class MessageBox extends Component {
|
|||
debouncedOnChangeText = debounce((text) => {
|
||||
this.setInput(text);
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const { start, end } = this.component._lastNativeSelection;
|
||||
const cursor = Math.max(start, end);
|
||||
const lastNativeText = this.component._lastNativeText;
|
||||
const regexp = /(#|@|:)([a-z0-9._-]+)$/im;
|
||||
const result = lastNativeText.substr(0, cursor).match(regexp);
|
||||
if (!result) {
|
||||
return this.stopTrackingMention();
|
||||
}
|
||||
const [, lastChar, name] = result;
|
||||
this.identifyMentionKeyword(name, lastChar);
|
||||
});
|
||||
if (this.component) {
|
||||
requestAnimationFrame(() => {
|
||||
const { start, end } = this.component._lastNativeSelection;
|
||||
const cursor = Math.max(start, end);
|
||||
const lastNativeText = this.component._lastNativeText;
|
||||
const regexp = /(#|@|:)([a-z0-9._-]+)$/im;
|
||||
const result = lastNativeText.substr(0, cursor).match(regexp);
|
||||
if (!result) {
|
||||
return this.stopTrackingMention();
|
||||
}
|
||||
const [, lastChar, name] = result;
|
||||
this.identifyMentionKeyword(name, lastChar);
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
|
||||
onKeyboardResigned = () => {
|
||||
|
@ -188,6 +190,9 @@ export default class MessageBox extends Component {
|
|||
}
|
||||
|
||||
onPressMention = (item) => {
|
||||
if (!this.component) {
|
||||
return;
|
||||
}
|
||||
const { trackingType } = this.state;
|
||||
const msg = this.text;
|
||||
const { start, end } = this.component._lastNativeSelection;
|
||||
|
@ -199,7 +204,7 @@ export default class MessageBox extends Component {
|
|||
: (item.username || item.name);
|
||||
const text = `${ result }${ mentionName } ${ msg.slice(cursor) }`;
|
||||
this.setInput(text);
|
||||
this.component.focus();
|
||||
this.focus();
|
||||
requestAnimationFrame(() => this.stopTrackingMention());
|
||||
}
|
||||
|
||||
|
@ -209,7 +214,7 @@ export default class MessageBox extends Component {
|
|||
let newText = '';
|
||||
|
||||
// if messagebox has an active cursor
|
||||
if (this.component._lastNativeSelection) {
|
||||
if (this.component && this.component._lastNativeSelection) {
|
||||
const { start, end } = this.component._lastNativeSelection;
|
||||
const cursor = Math.max(start, end);
|
||||
newText = `${ text.substr(0, cursor) }${ emoji }${ text.substr(cursor) }`;
|
||||
|
@ -434,6 +439,12 @@ export default class MessageBox extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
focus = () => {
|
||||
if (this.component && this.component.focus) {
|
||||
this.component.focus();
|
||||
}
|
||||
}
|
||||
|
||||
handleTyping = (isTyping) => {
|
||||
const { typing } = this.props;
|
||||
if (!isTyping) {
|
||||
|
@ -457,7 +468,9 @@ export default class MessageBox extends Component {
|
|||
|
||||
setInput = (text) => {
|
||||
this.text = text;
|
||||
this.component.setNativeProps({ text });
|
||||
if (this.component && this.component.setNativeProps) {
|
||||
this.component.setNativeProps({ text });
|
||||
}
|
||||
}
|
||||
|
||||
setShowSend = (showSend) => {
|
||||
|
|
|
@ -87,7 +87,7 @@ export default class RoomsListView extends LoggedView {
|
|||
title: {
|
||||
component: {
|
||||
name: 'RoomsListHeaderView',
|
||||
alignment: isAndroid ? 'left' : 'center'
|
||||
alignment: isAndroid ? 'left' : 'fill'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -709,3 +709,5 @@ export default class RoomsListView extends LoggedView {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
console.disableYellowBox = true;
|
||||
|
|
Loading…
Reference in New Issue