Files
react-native-firebase/tests/app.js
Michael Diarmid d3b9b24cca [android][database] database improvements (#1619)
- [ANDROID] [BUGFIX] [DATABASE] - Database listeners now correctly tearing down between RN reloads. (Fixes #1498 #1611 #1609)
 - [JS] [BUGFIX] [DATABASE] - Fixed an issue where `Reference.toString()` incorrectly contains `//` instead of `/` when joining the parent and child paths.
 - [JS] [BUGFIX] [DATABASE] - Rework `.push()` behaviour to match WebSDK and correctly return a Reference instance in all scenarios. (Fixes #893 #1464 #1572)
 - [JS] [ENHANCEMENT] [UTILS] - Added a `firebase.utils().database.cleanup()` utility method which removes all database listeners.
2018-10-27 05:34:09 +01:00

118 lines
2.5 KiB
JavaScript
Executable File

/* eslint-disable import/extensions,import/no-unresolved,import/first */
import React, { Component } from 'react';
import {
AppRegistry,
Text,
View,
Image,
StyleSheet,
YellowBox,
} from 'react-native';
YellowBox.ignoreWarnings(['Require cycle:']);
import firebase from 'react-native-firebase';
import jet from 'jet/platform/react-native';
class Root extends Component {
constructor(props) {
super(props);
this.state = {
currentTest: null,
};
jet.exposeContextProperty('root', this);
jet.exposeContextProperty('module', firebase);
}
render() {
const { currentTest } = this.state;
if (!currentTest) return null;
const module = (() => {
if (currentTest.parent && currentTest.parent.parent) {
return currentTest.parent.parent.title;
}
return currentTest.parent.title;
})();
const group = (() => {
if (currentTest.parent && currentTest.parent.parent) {
return currentTest.parent.title;
}
return '';
})();
const retrying = (() => {
const retry = currentTest.currentRetry();
if (retry > 0) {
return `⚠️ Test failed, retrying... (${retry})`;
}
return null;
})();
return (
<View style={[styles.container, styles.horizontal]}>
<Image
source={{
uri:
'https://github.com/invertase/react-native-firebase-starter/raw/master/assets/RNFirebase.png',
}}
style={[styles.logo]}
/>
<Text style={[styles.item, styles.module]} testID="module">
{module}
</Text>
<Text style={styles.item} testID="group">
{group}
</Text>
<Text style={styles.item} testID="title">
{currentTest.title}
</Text>
{retrying && (
<Text style={[styles.retry, styles.item]} testID="title">
{retrying}
</Text>
)}
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
horizontal: {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
padding: 10,
},
item: {
marginBottom: 10,
textAlign: 'center',
},
retry: {
marginTop: 10,
fontSize: 20,
color: '#cccc33',
},
module: {
fontSize: 20,
fontWeight: 'bold',
},
group: {
fontSize: 16,
color: 'grey',
},
logo: {
height: 120,
marginBottom: 16,
width: 120,
},
});
AppRegistry.registerComponent('testing', () => Root);