react-native-popup-menu
Advanced tools
Comparing version 0.13.0-beta.1 to 0.13.0-rc.1
{ | ||
"name": "react-native-popup-menu", | ||
"version": "0.13.0-beta.1", | ||
"version": "0.13.0-rc.1", | ||
"description": "extensible popup/context menu for react native", | ||
@@ -23,2 +23,3 @@ "main": "src/index.js", | ||
"homepage": "https://github.com/instea/react-native-popup-menu", | ||
"typings": "src/index.d.ts", | ||
"jest": { | ||
@@ -61,5 +62,5 @@ "transform": { | ||
"prop-types": "^15.5.10", | ||
"react": "^15.5.4", | ||
"react-dom": "^15.5.4", | ||
"react-test-renderer": "^15.6.1", | ||
"react": "^16.3.1", | ||
"react-dom": "^16.3.1", | ||
"react-test-renderer": "^16.3.1", | ||
"sinon": "^2.2.0" | ||
@@ -66,0 +67,0 @@ }, |
# react-native-popup-menu | ||
[![](https://img.shields.io/npm/dm/react-native-popup-menu.svg?style=flat-square)](https://www.npmjs.com/package/react-native-popup-menu) | ||
Extensible popup menu component for React Native for Android, iOS and (unofficially) UWP. | ||
Extensible popup menu component for React Native for Android, iOS and (unofficially) UWP and react-native-web. | ||
@@ -17,2 +17,8 @@ Features: | ||
Community driven features: | ||
* Support for UWP and react-native-web | ||
* Typescript definitions | ||
We thank our community for maintaining features that goes over our scope. | ||
| Context Menu, Slide-in Menu | Popover | | ||
@@ -29,2 +35,4 @@ |---|---| | ||
If you are using RN 0.55+, you might want to check our beta version (see [#90](https://github.com/instea/react-native-popup-menu/issues/90) for details and please leave us the feedback) | ||
## Basic Usage | ||
@@ -31,0 +39,0 @@ Wrap your application inside `MenuProvider` and then simply use `Menu` component where you need it. Below you can find a simple example. |
@@ -30,4 +30,5 @@ import React from 'react'; | ||
const Touchable = TouchableComponent || Platform.select({ | ||
android: TouchableNativeFeedback, | ||
ios: TouchableHighlight, | ||
android: TouchableNativeFeedback, | ||
web: TouchableHighlight, | ||
windows:TouchableHighlight, | ||
@@ -34,0 +35,0 @@ }); |
@@ -14,3 +14,3 @@ import React, { Component } from 'react'; | ||
class Menu extends Component { | ||
export class Menu extends Component { | ||
@@ -131,10 +131,2 @@ constructor(props) { | ||
Menu.debug = false; | ||
Menu.setDefaultRenderer = (renderer) => { | ||
Menu.defaultProps.renderer = renderer; | ||
} | ||
Menu.setDefaultRendererProps = (rendererProps) => { | ||
Menu.defaultProps.rendererProps = rendererProps; | ||
} | ||
Menu.propTypes = { | ||
@@ -160,2 +152,10 @@ name: PropTypes.string, | ||
export default withCtx(Menu); | ||
const MenuExternal = withCtx(Menu); | ||
MenuExternal.debug = false; | ||
MenuExternal.setDefaultRenderer = (renderer) => { | ||
Menu.defaultProps.renderer = renderer; | ||
} | ||
MenuExternal.setDefaultRendererProps = (rendererProps) => { | ||
Menu.defaultProps.rendererProps = rendererProps; | ||
} | ||
export default MenuExternal; |
@@ -9,3 +9,3 @@ import React, { Component } from 'react'; | ||
class MenuOption extends Component { | ||
export class MenuOption extends Component { | ||
@@ -12,0 +12,0 @@ _onSelect() { |
@@ -6,3 +6,3 @@ import React from 'react'; | ||
class _MenuOptions extends React.Component { | ||
export class MenuOptions extends React.Component { | ||
@@ -36,4 +36,2 @@ updateCustomStyles(_props) { | ||
const MenuOptions = withCtx(_MenuOptions) | ||
MenuOptions.propTypes = { | ||
@@ -53,2 +51,2 @@ customStyles: PropTypes.object, | ||
export default MenuOptions; | ||
export default withCtx(MenuOptions); |
@@ -22,3 +22,3 @@ import React, { Component, createContext } from 'react'; | ||
} | ||
const PopupMenuContext = createContext({}) | ||
export const PopupMenuContext = createContext({}) | ||
export const withCtx = withContext(PopupMenuContext, "ctx"); | ||
@@ -25,0 +25,0 @@ |
@@ -8,3 +8,3 @@ import React, { Component } from 'react'; | ||
class MenuTrigger extends Component { | ||
export class MenuTrigger extends Component { | ||
@@ -11,0 +11,0 @@ _onPress() { |
import React from 'react'; | ||
import { I18nManager, Animated, Easing, StyleSheet } from 'react-native'; | ||
import { I18nManager, Animated, Easing, StyleSheet, PixelRatio } from 'react-native'; | ||
import { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from '../constants'; | ||
@@ -95,3 +95,3 @@ | ||
backgroundColor: 'white', | ||
width: 200, | ||
width: PixelRatio.roundToNearestPixel(200), | ||
@@ -98,0 +98,0 @@ // Shadow only works on iOS. |
@@ -35,7 +35,7 @@ import React from "react"; | ||
enhanceForwardRef.defaultProps = Component.defaultProps; | ||
enhanceForwardRef.propTypes = Component.propTypes; | ||
return React.forwardRef(enhanceForwardRef); | ||
const FC = React.forwardRef(enhanceForwardRef); | ||
FC.defaultProps = Component.defaultProps; | ||
FC.propTypes = Component.propTypes; | ||
return FC | ||
}; | ||
} |
323103
29
1583
94