Giter Site home page Giter Site logo

Comments (4)

dabit3 avatar dabit3 commented on May 3, 2024 2

Are you getting any errors here?

from react-native-elements.

Monte9 avatar Monte9 commented on May 3, 2024 1

@abhitheawesomecoder there are a couple issues with your code.

  1. The Text element needs to be wrapped within a View container with a flex 1 and a backgroundColor as the default is transparent.
  2. You are missing a toggle button on the view that actually opens/closes the Side Menu.

@afdalwahyu I would guess you have the same problem because you are using a similar code as @abhitheawesomecoder?

This should work for both you guys, try it out:

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight
} from 'react-native';
import { SideMenu, List, ListItem } from 'react-native-elements';
import Icon from 'react-native-vector-icons/MaterialIcons'

export default class Element extends Component {
  constructor () {
  super()
  this.state = { toggled: false }
}
toggleSideMenu () {
  this.setState({
    toggled: !this.state.toggled
  })
}
  render() {
    // SideMenu takes a React Native element as a prop for the actual Side Menu
    const list = [
  {
    name: 'Amy Farha',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
    subtitle: 'Vice President'
  },
  {
    name: 'Chris Jackson',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
    subtitle: 'Vice Chairman'
  }
]
  const MenuComponent = (
    <View style={{flex: 1, backgroundColor: '#ededed', paddingTop: 50}}>
      <List containerStyle={{marginBottom: 20}}>
      {
        list.map((item, i) => (
          <ListItem
            roundAvatar
            onPress={() => console.log(item.avatar_url)}
            avatar={{uri:item.avatar_url}}
            key={i}
            title={item.name}
            subtitle={item.subtitle} />
        ))
      }
      </List>
    </View>
  )
    return (
      <SideMenu
        MenuComponent={MenuComponent}
        toggled={this.state.toggled}>
        <View style={styles.container}>
          <TouchableHighlight
            style={{marginTop: 7, marginLeft: 9}}
            onPress={this.toggleSideMenu.bind(this)}
            underlayColor='transparent'>
            <Icon
              color='black'
              name='menu'
              size={28}
            />
          </TouchableHighlight>
          <Text style={styles.welcome}>Working Side Menu Example</Text>
        </View>
      </SideMenu>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

AppRegistry.registerComponent('Element', () => Element);

from react-native-elements.

abhitheawesomecoder avatar abhitheawesomecoder commented on May 3, 2024

No errors
On 07-Nov-2016 10:02 pm, "Nader Dabit" [email protected] wrote:

Are you getting any errors here?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#76 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADwwThUBytz5XIKUpu7KzGAmjwAaGv2Fks5q71KkgaJpZM4KjSTO
.

from react-native-elements.

afdalwahyu avatar afdalwahyu commented on May 3, 2024

+1
I have same problem with Android 6.1

from react-native-elements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.