Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
147 views
in Technique[技术] by (71.8m points)

javascript - How do I make a back button for Webview

How do I make a back button in the stack navigator for web view. Please Help! I keep on trying, but I just get errors. If you can provide me with a code with a back arrow icon. I deleted it, but I actually have five different pages. All of the have a bottom navigation bar, a stack navigation bar, and is using webview. Thank you!

// pages
function HomeScreen({ navigation }) {
      
        return (
          <WebView
            source={{
              uri: 'https://www.stoodnt.com/'
            }}
            style={{ marginTop: -120 }}
          />
        );
         
}

// Stack Navigation
const HomeStack = createStackNavigator();
function HomeStackScreen() {
 return (
   <HomeStack.Navigator>
    <HomeStack.Screen name="Home" component={HomeScreen} />
   </HomeStack.Navigator>
  );
}


// Bottom Navigation
const Tab = createBottomTabNavigator();

export default function App() {

    return (
       <NavigationContainer>
         <Tab.Navigator
           screenOptions={({ route }) => ({
             tabBarIcon: ({ focused, color, size }) => {
               let iconName;

            if (route.name === 'Home') {
              iconName = focused
                ? 'ios-home'
                : 'ios-home';
            } 
   
            return <Ionicons name={iconName} size={40} color={'orange'} />;

          },
        })}
            tabBarOptions={{
              activeTintColor: '#000000',
              inactiveTintColor: '#616161',
              labelStyle: {
                fontSize: 11,
              },
              style: {
                backgroundColor: '#F7F7F7',
              },
    }}

      >

          <Tab.Screen name="Home" component={HomeStackScreen} />

        </Tab.Navigator>
    </NavigationContainer>  

  );

}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
question from:https://stackoverflow.com/questions/65623558/how-do-i-make-a-back-button-for-webview

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...