Skip to content

Commit

Permalink
Update Expo app template code (microsoft#1279)
Browse files Browse the repository at this point in the history
* bugfix: change Expo app template code
* bugfix: add timeout before checking that dev menu is being clicked
  • Loading branch information
SounD120 committed May 14, 2020
1 parent b85586f commit e76d63b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 39 deletions.
47 changes: 8 additions & 39 deletions test/smoke/package/resources/ExpoSample/App.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,25 @@
console.log("Test output from debuggee");
import * as React from 'react';
import { Platform, StatusBar, StyleSheet, View } from 'react-native';
import { SplashScreen } from 'expo';
import * as Font from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import * as React from 'react';
import { Platform, StatusBar, StyleSheet, View } from 'react-native';

import useCachedResources from './hooks/useCachedResources';
import BottomTabNavigator from './navigation/BottomTabNavigator';
import useLinking from './navigation/useLinking';
import LinkingConfiguration from './navigation/LinkingConfiguration';

const Stack = createStackNavigator();

export default function App(props) {
const [isLoadingComplete, setLoadingComplete] = React.useState(false);
const [initialNavigationState, setInitialNavigationState] = React.useState();
const containerRef = React.useRef();
const { getInitialState } = useLinking(containerRef);

// Load any resources or data that we need prior to rendering the app
React.useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
SplashScreen.preventAutoHide();

// Load our initial navigation state
setInitialNavigationState(await getInitialState());

// Load fonts
await Font.loadAsync({
...Ionicons.font,
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
});
} catch (e) {
// We might want to provide this error information to an error reporting service
console.warn(e);
} finally {
setLoadingComplete(true);
SplashScreen.hide();
}
}

loadResourcesAndDataAsync();
}, []);
const isLoadingComplete = useCachedResources();

if (!isLoadingComplete && !props.skipLoadingScreen) {
if (!isLoadingComplete) {
return null;
} else {
return (
<View style={styles.container}>
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
<NavigationContainer ref={containerRef} initialState={initialNavigationState}>
{Platform.OS === 'ios' && <StatusBar barStyle="dark-content" />}
<NavigationContainer linking={LinkingConfiguration}>
<Stack.Navigator>
<Stack.Screen name="Root" component={BottomTabNavigator} />
</Stack.Navigator>
Expand Down
1 change: 1 addition & 0 deletions test/smoke/package/src/helpers/appiumHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export class AppiumHelper {
console.log("*** Debug JS Remotely button found...");
await client.click(this.XPATH.RN_ENABLE_REMOTE_DEBUGGING_BUTTON[platform]);
console.log("*** Debug JS Remotely button clicked...");
await sleep(1000);
if (await client.isExisting(this.XPATH.RN_ENABLE_REMOTE_DEBUGGING_BUTTON[platform])) {
await client.click(this.XPATH.RN_ENABLE_REMOTE_DEBUGGING_BUTTON[platform]);
console.log("*** Debug JS Remotely button clicked second time...");
Expand Down

0 comments on commit e76d63b

Please sign in to comment.