Git Product home page Git Product logo

react-native-radial-menu's Introduction

React Native Radial Menu

npm version npm downloads

Installation

npm install react-native-radial-menu

Usage

var RadialMenu = require('react-native-radial-menu');

var Application = React.createClass({
  render: function() {
    return (
      <View>
        <RadialMenu onOpen={() => {}} onClose={() => {}}>
          <Text>ROOT</Text>
          <Text onSelect={() => {}}>A</Text>
          <Text onSelect={() => {}}>B</Text>
          <Text onSelect={() => {}}>C</Text>
          <Text onSelect={() => {}}>D</Text>
        </RadialMenu>
      </View>
    )
  }
})

Examples

// Examples Coming soon

Props

This menu can be fully customized using props.

Important
  • itemRadius (Number) 30 - Menu item radius
  • menuRadius (Number) 100- Distance between root and items in open state.
  • spreadAngle (Number: 0 - 360) 360 - The angle in degrees based on which menu items are spread on a circle around our root. E.g. 360 full circle, 180 half of circle and so on.
  • startAngle (Number) 0 - Items are distributed in clockwise direction starting from startAngle. 0 is left, 90 top, and so on.
Menu Callbacks
  • onOpen (Function) - Called immediately after the menu has entered the open state.
  • onClose (Function) - Called immediately after the menu has entered the close state.
Menu Item Callbacks
  • onSelect (Function) - Called when the item is selected
Animations

Coming soon

Demo

  • git clone https://github.com/omulet/react-native-radial-menu.git
  • cd react-native-radial-menu/examples/rnRadialMenu && npm install
  • Open ``./examples/rnRadialMenu/ios/rnRadialMenu.xcodeproject` in xcode
  • command+r (in xcode)

Credits

react-native-radial-menu's People

Contributors

olisteadman avatar omulet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-radial-menu's Issues

Images do not work in radial menu

Is there any way to use icons instead of text in the radial menu?
Adding Images with did not work, as the space for them gets reserved but they do not show up.

React-native-radial-menu fails in production

hi guys i am about to launch an application in react-native and i am using this component, but when i navigate to a view that contains react-native-radial-menu it fails, basically the phone turns off like 10 secs, and then gets me out from the app, everything else in the app is working just fine. the strange thing here, is that it was working well for testing no issues there, not warnings in the console, but when i attached the BUNDLE (command react-native bundle) to the device itself. the component's behavior changed, in simulator it was very very slow, in the real device just fails. my device for testing is an iphone 5s.

Note: when i replace the component for a simple to test if there is something wrong in my code, everything run good

Android Example

the example code do not work properly on android , the button doesn't appear when i tap on the main button

Items can't be Touchables on Android

works well on iOS, but onPress doesn't get triggered on Android. Any workaround?

<RadialMenu onOpen={() => {}} onClose={() => {}}>
  <Text>ROOT</Text>
  <TouchableOpacity onSelect={() => {}} onPress={() => Alert.alert("test","test")}>A</TouchableOpacity>
  <TouchableOpacity onSelect={() => {}} onPress={() => Alert.alert("test","test")}>B</TouchableOpacity>
  <TouchableOpacity onSelect={() => {}} onPress={() => Alert.alert("test","test")}>C</TouchableOpacity>
  <TouchableOpacity onSelect={() => {}} onPress={() => Alert.alert("test","test")}>D</TouchableOpacity>
</RadialMenu>

Making it impossible to swipe completely through items?

Is there a way to make the items connect to the root from a further ditance and faster? and prohibit the root to surpass the items? Or make the root snap back if it surpasses them?

img_20171207_125515_777

I want to prevent this from happening. And maybe tweak things a bit so that items connect and attach faster and therefor trigger onSelect() faster. Is there a way to do this?

error running radialmenu

simulator screen shot oct 27 2016 10 27 30 am

here is the code

/**

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
var RadialMenu = require('react-native-radial-menu');

export default class rmnu extends Component {
componentWillMount() {
this.setState({output: ""});
}

_onOpen() {
this.setState({
output: 'on menu open'
})
}

_onClose() {
this.setState({
output: 'on menu close'
})
}

renderItems(count) {
return [...Array(count)].map((_, i) => {
return (
<View style={styles.item} key={i}
onSelect={ () => {
this.setState({output: onSelect ${i}})
} }>
{i}

);
})
}

renderRoot() {
return (
<View style={[styles.item, styles.root]}>
MENU

)
}

render() {
return (

{this.state.output}
<RadialMenu onOpen={() => {}} onClose={() => {}}>
ROOT
<Text onSelect={() => {}}>A
<Text onSelect={() => {}}>B
<Text onSelect={() => {}}>C
<Text onSelect={() => {}}>D


)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
item: {
height: 60,
width: 60,
borderRadius: 30,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#DDD'
},
root: {
backgroundColor: '#FFCC00'
}
});

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

Error during start up

I get this error during startup:

radial

I installed it normally using npm.
Deleting node_modules folder, clearing cache and reinstalling did not solve the issue.
It can't find the radial menu module. Other modules like navigation work.

Alignment does not work on Android

The radial menu's functionality works great and is exactly what I have searched for,
However there is one problem with the alignment of the menu on Android. No matter the props or style settings.

screenshot from 2017-10-30 12-45-16

While I think the center alignment works in theory due to the fact that there is space reserved, The root and children nodes are not being centered with the radial menu's outer layout, but instead always at the top left corner, even while other items added to the main View are centered correctly.

react-native: 0.49.3

Edit: The problem was related to another special component in the same view. It somehow caused layout problems.

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.