@react-navigation/native#navigation JavaScript Examples

The following examples show how to use @react-navigation/native#navigation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.js    From redis-examples with MIT License 6 votes vote down vote up
function App({navigation}) {
  return (
        <NavigationContainer  ref={navigationRef}>
          <Stack.Navigator>
            <Stack.Screen
              options={{
                gestureEnabled: false,
                title: "Announcements",
                headerTitleAlign: 'center',
                headerStyle: {
                  backgroundColor: '#f4511e',
                },
                headerTintColor: '#fff',
                headerTitleStyle: {
                  fontWeight: 'bold',
                },
                transitionSpec: {
                  open: config2,
                  close: config2,
                },
              }}
              name="Appp"
              component={Appp}
            />
          </Stack.Navigator>
        </NavigationContainer>
  );
}
Example #2
Source File: App.js    From redis-examples with MIT License 5 votes vote down vote up
function App({navigation}) {
  return (
        <NavigationContainer  ref={navigationRef}>
          <Stack.Navigator>
            <Stack.Screen
              options={{
                gestureEnabled: false,
                title: "Submit Score",
                headerTitleAlign: 'center',
                headerStyle: {
                  backgroundColor: '#f4511e',
                },
                headerTintColor: '#fff',
                headerTitleStyle: {
                  fontWeight: 'bold',
                },
                transitionSpec: {
                  open: config2,
                  close: config2,
                },
              }}
              name="Appp"
              component={Appp}
            />

            <Stack.Screen
              options={{
                gestureEnabled: false,
                title: "Leaderboard",
                headerTitleAlign: 'center',
                headerStyle: {
                  backgroundColor: '#f4511e',
                },
                headerTintColor: '#fff',
                headerTitleStyle: {
                  fontWeight: 'bold',
                },
                transitionSpec: {
                  open: config,
                  close: config,
                },
              }}
              name="Leaderboard"
              component={LeaderboardScreen}
            />
          </Stack.Navigator>
        </NavigationContainer>
  );
}
Example #3
Source File: App.js    From redis-examples with MIT License 4 votes vote down vote up
render(){
    this.height = Math.round(Dimensions.get('screen').height);
    this.width = Math.round(Dimensions.get('screen').width);
    return (
      <SafeAreaView style={{
        width: this.width,
        height: this.height,
        flex: 1,
        alignItems: 'center'}}>
        <StatusBar
        backgroundColor="#f4511e"/>
        <View style={{height: this.height/8}} />
        <View
          style={{
            flex:1,
            width: this.width,
            alignItems: 'center',
            justifyContent: 'center',
          }}>
          <View
            style={{
              flex:1,
              width: this.width,
              alignItems: 'center',
              justifyContent: 'center',
            }}>
            <TextInput
              spellCheck={false}
              autoCorrect={false}
              placeholderTextColor="rgba(0,0,0,0.4)"
              placeholder={"First name"}
              style={{
                width: this.width*7/10,
                borderColor: 'purple',
                borderWidth: 1,
                borderRadius: 8
              }}
              onChangeText={(text) =>
                this.setState({firstname: text})
              }></TextInput>
          </View>
          <View
            style={{
              flex:1,
              width: this.width,
              alignItems: 'center',
              justifyContent: 'center',
            }}>
            <TextInput
              spellCheck={false}
              autoCorrect={false}
              placeholderTextColor="rgba(0,0,0,0.4)"
              placeholder={"Last name"}
              style={{
                width: this.width*7/10,
                borderColor: 'purple',
                borderWidth: 1,
                borderRadius: 8
              }}
              onChangeText={(text) =>
                this.setState({lastname: text})
              }></TextInput>
          </View>
          <View
            style={{
              flex:1,
              width: this.width,
              alignItems: 'center',
              justifyContent: 'center',
            }}>
            <TextInput
              spellCheck={false}
              autoCorrect={false}
              placeholderTextColor="rgba(0,0,0,0.4)"
              placeholder={"Score"}
              style={{
                width: this.width*7/10,
                borderColor: 'purple',
                borderWidth: 1,
                borderRadius: 8
              }}
              onChangeText={(text) =>
                this.setState({score: text})
              }></TextInput>
          </View>
        </View>
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center'}}>
          <TouchableHighlight
            style={{backgroundColor: "green", alignItems: 'center', borderColor: "green",
            borderRadius: 8, borderWidth: 1, paddingVertical: 10, paddingHorizontal: 20}}
            onPress={() =>{this.addScore()}}>
            <Text style={{color:"white"}}>Submit Score</Text>
          </TouchableHighlight>
        </View>
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center'}}>
          <TouchableHighlight
            style={{backgroundColor: "#2196F3", alignItems: 'center', borderColor: "#2196F3",
            borderRadius: 8, borderWidth: 1, paddingVertical: 10, paddingHorizontal: 20}}
            onPress={() =>{this.props.navigation.navigate('Leaderboard')}}>
            <Text style={{color:"white"}}>Go to Leaderboard</Text>
          </TouchableHighlight>
        </View>
      </SafeAreaView>
    );
  }