Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NavigationExperimental] Android support? #7661

Closed
actonw opened this issue May 20, 2016 · 9 comments
Closed

[NavigationExperimental] Android support? #7661

actonw opened this issue May 20, 2016 · 9 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@actonw
Copy link

actonw commented May 20, 2016

Is there currently Android support for NavigationExperimental? I'm trying to use it, but when I use the NavigationCard all I get is a blank screen; when I eschew NavigationCard, the scenes don't change and animations in NavigationHeader lag pretty badly.

@ericvicenti

@ericvicenti ericvicenti self-assigned this May 20, 2016
@ericvicenti
Copy link
Contributor

I just tested NavigationCard within the UIExplorer examples and it looks fine. Can you post a code snippet and specific react-native version number?

@actonw
Copy link
Author

actonw commented May 23, 2016

Code snippet:

import React from 'react';
import {
  View,
  NavigationExperimental,
} from 'react-native';

const {
  AnimatedView,
  Card,
  Header,
} = NavigationExperimental;

import { chooseView } from '../menuItems';

export function Navigation({ navigation, onNavigate }) {
  return (
    <AnimatedView
      navigationState={navigation}
      onNavigate={onNavigate}
      renderOverlay={props => (
        <Header
          {...props}
          renderTitleComponent={props => {
            const title = props.scene.navigationState.title
            return <Header.Title>{title}</Header.Title>
          }}
        />
      )}
      renderScene={(props) => {
        return (<Card
          {...props}
          key={props.scene.navigationState.key}
          renderScene={({ scene: { navigationState } }) => {
              console.log(navigationState);
              const CurrentView = chooseView(navigationState.key);
              return <CurrentView />;
          }}
        />);
      }}
    />
  );
}

chooseView is simply a function that returns a component based on the key:

export function chooseView(key) {
  if (key === 'Home') {
    return HomeView;
  }
  else if (key === 'preferences_view') {
    return Preferences;
  }
  else if (key === 'map_view') {
    return MapPage;
  }
  else if (key === 'fun_view') {
    return Fun;
  }
  return null;
}

I'm using react-native 0.26.0.

This works fine on iOS, however shows a blank white screen on Android. Inspecting anything simply shows a blank View in the AppContainer.

@satya164
Copy link
Contributor

Are using an emulator or a real device?

@actonw
Copy link
Author

actonw commented May 23, 2016

@satya164 I'm using Google's stock emulator w/ Google APIs.

@satya164
Copy link
Contributor

@actonw Try using Genymotion or a Real device.

@actonw
Copy link
Author

actonw commented May 24, 2016

@satya164 I am not able to use genymotion or a real device at this point. I'm not sure exactly what relevance this has, since the NavigationCard does not involve any unique native code.

@actonw
Copy link
Author

actonw commented May 24, 2016

@ericvicenti @satya164 Adding style={{ flex: 1}} to the NavigationAnimatedView component seems to have fixed the lack of display in Android, however the opacity/animation is not quite the same.
screen shot 2016-05-24 at 12 14 23 pm

@mkonicek
Copy link
Contributor

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/navigationexperimental-android-support

Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants
@mkonicek @satya164 @ericvicenti @christopherdro @actonw @react-native-bot and others