thethreeonee / react-native-image-button

10 stars 6 forks source link

Error when importing react-native image-button #4

Open ghost opened 6 years ago

ghost commented 6 years ago

I get the following error message when importing react-native image button. I have installed and linked to React Native.

simulator screen shot - iphone 6 - 2017-10-09 at 16 55 07

Any help would be appreciated as I would really like to use this button.

import React, { Component } from 'react';
import { AppRegistry, StyleSheet, View, FlatList, Image, TouchableHighlight} from 'react-native';

import { TabNavigator, StackNavigator } from 'react-navigation';

import ImageButton from 'react-native-img-button';

import { Container, Content, Header, Left, Body, Right, Button, Icon, Title, Text, List, ListItem, Thumbnail } from 'native-base';

import Realm from 'realm';

class identifyWizard extends React.Component {
      constructor(){
    super(props);
  }
    static navigationOptions = {
tabBarLabel: 'Identify Wizard',
    tabBarIcon: ({ tintColor }) => (
    <Image
        source={require('./assets/identify.png')}
        style={[styles.icon, {tintColor: tintColor}]}
      />
),
  };

 onPressButton() {
    console.log("Pressed!");
  }

  render() {

    return(
        <Container>
                <Header style={styles.header}>
          <Left>
          </Left>
          <Body>
            <Title>Identify Wizard</Title>
          </Body>
          <Right>
          </Right>
        </Header>
        <ImageButton
          style={ styles.btn }
          appearance={ {
            normal: require("./assets/smooth.png"),
            highlight: require("./assets/smoothGreen.png")
          } }
          onPress={ this.onPressButton }/>
        </Container>
);
}
}
Cetzcher commented 6 years ago

I had the same problem. I created a pull request. The problem is that extends Component in index.js will not work at least on RN 0.50.4. check out my fork at https://github.com/Cetzcher/react-native-image-button

thethreeonee commented 6 years ago

Thanks for the PR. Please help to try if the merged code works. If works, I'll close this issue. Thanks a lot.