Skip to content

Unnecessary Warning for ViewPagerAndroid #16343

@Palisand

Description

@Palisand

Is this a bug report?

Yes.

Have you read the Contributing Guidelines?

Yes.

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.4.0
Yarn: 1.0.1
npm: 4.6.1
Watchman: 4.9.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: ^16.0.0-beta.5 => 16.0.0-beta.5
react-native: 0.49.3 => 0.49.3

Steps to Reproduce

  1. Run an app with the following code on your Android device:
import React, { Component } from 'react';
import { ViewPagerAndroid } from 'react-native';

const Page = () => <View />;

const Pager = ({children}) => <ViewPagerAndroid>{children}</ViewPagerAndroid>;

export default class App extends Component {
  render() {
    return (
      <Pager>
        <Page />
        <Page />
      </Pager>
    );
  }
}
  1. Observe warning.

Expected Behavior

There should be no warning as Page renders a View.

Actual Behavior

Warning:

Each ViewPager child must be a <View>. Was Page.

Reproducible Demo

Unavailable. Issue exists on RN 0.49. Expo SDK 21 uses 0.48.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions