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

data.isReactElement has been deprecated from RN 0.13 #120

Closed
leemarreros opened this issue Dec 10, 2015 · 3 comments
Closed

data.isReactElement has been deprecated from RN 0.13 #120

leemarreros opened this issue Dec 10, 2015 · 3 comments

Comments

@leemarreros
Copy link
Contributor

Inside index.js that belongs to react-native-navbar, there is an if statement that is not being triggered when a react component is passed through "leftButton" prop.
At any given time, data._isReactElement is not recognized. There is chance that it got deprecated after RN 0.13 (facebook/react#3220 and facebook/react#3473).

getButtonElement(data = {}, style) {
    if (data._isReactElement) {
      return <View style={styles.navBarButton}>{data}</View>;
    }
//...

Any workaround for this?

@leemarreros
Copy link
Contributor Author

This is the way I fixed.
I wen to index.js that belongs to react-native-navbar to change it to this:

//from
getButtonElement(data = {}, style) {
    console.log('data inside module', data);
    if (data._isReactElement ){
      return <View style={styles.navBarButton}>{data}</View>;
    }
//
getButtonElement(data = {}, style) {
    console.log('data inside module', data);
    if (!!data.props ){
      return <View style={styles.navBarButton}>{data}</View>;
    }

and

// from 
getTitleElement(data) {
    if (data._isReactElement) {
      return <View style={styles.customTitle}>{data}</View>;
    }
//to
getTitleElement(data) {
    if (!!data.props) {
      return <View style={styles.customTitle}>{data}</View>;
    }

However, to make it work, inside

<NavigationBar
          leftButton={
            <TouchableOpacity style={styles.buttonNavBar} onPress={()=> this.props.navigator.pop()}>
              <Image
                source={require('../img/back-icon.png')}
                style={[{ width: 15, height: 15}]}/>
            </TouchableOpacity>
          }/>

I have to define the component directly to leftButton and not creating a class Component because the later one is gotten as a function.

@Kureev
Copy link
Owner

Kureev commented Dec 10, 2015

LGTM, can you compose a PR?

@grabbou
Copy link
Collaborator

grabbou commented Dec 14, 2015

Fixed in #121

@grabbou grabbou closed this as completed Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants