@@ -44,7 +44,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
4444var React = require ( "react" ) ;
4545var react_native_1 = require ( "react-native" ) ;
4646/* Utils - Project Utilities */
47+ var RNNDrawer_1 = require ( "./RNNDrawer" ) ;
4748var events_1 = require ( "./events" ) ;
49+ var RNNDrawer_2 = require ( "./RNNDrawer" ) ;
4850var screenHeight = react_native_1 . Dimensions . get ( 'screen' ) . height ;
4951var SideMenuView = /** @class */ ( function ( _super ) {
5052 __extends ( SideMenuView , _super ) ;
@@ -58,7 +60,8 @@ var SideMenuView = /** @class */ (function (_super) {
5860 function SideMenuView ( props ) {
5961 var _this = _super . call ( this , props ) || this ;
6062 _this . isOpened = false ;
61- var swipeSensitivity = props . swipeSensitivity , left = props . left , right = props . right ;
63+ var swipeSensitivity = props . swipeSensitivity , drawerName = props . drawerName , direction = props . direction , passProps = props . passProps , options = props . options ;
64+ var directionIsLeft = direction ? direction == 'left' : true ;
6265 _this . _panResponderMethods = {
6366 // Ask to be the responder:
6467 onStartShouldSetPanResponder : function ( _evt , _gestureState ) { return true ; } ,
@@ -83,9 +86,15 @@ var SideMenuView = /** @class */ (function (_super) {
8386 events_1 . dispatch ( 'SWIPE_MOVE' , { value : moveX , direction : 'left' } ) ;
8487 // Left Swipe
8588 if ( typeof swipeSensitivity !== 'undefined' ) {
86- if ( vx > swipeSensitivity && ! _this . isOpened && left ) {
89+ if ( vx > swipeSensitivity && ! _this . isOpened && directionIsLeft ) {
8790 _this . isOpened = true ;
88- left ( ) ;
91+ RNNDrawer_1 . default . showDrawer ( {
92+ component : {
93+ name : drawerName ,
94+ passProps : __assign ( { direction : RNNDrawer_2 . DirectionType . left , parentComponentId : passProps === null || passProps === void 0 ? void 0 : passProps . parentComponentId } , passProps ) ,
95+ options : __assign ( { } , options ) ,
96+ } ,
97+ } ) ;
8998 }
9099 }
91100 } } ) ) ;
@@ -96,9 +105,15 @@ var SideMenuView = /** @class */ (function (_super) {
96105 events_1 . dispatch ( 'SWIPE_MOVE' , { value : moveX , direction : 'right' } ) ;
97106 // Right Swipe
98107 if ( typeof swipeSensitivity !== 'undefined' ) {
99- if ( vx > - swipeSensitivity && ! _this . isOpened && right ) {
108+ if ( vx > - swipeSensitivity && ! _this . isOpened && ! directionIsLeft ) {
100109 _this . isOpened = true ;
101- right ( ) ;
110+ RNNDrawer_1 . default . showDrawer ( {
111+ component : {
112+ name : drawerName ,
113+ passProps : __assign ( { direction : RNNDrawer_2 . DirectionType . right , parentComponentId : passProps === null || passProps === void 0 ? void 0 : passProps . parentComponentId } , passProps ) ,
114+ options : __assign ( { } , options ) ,
115+ } ,
116+ } ) ;
102117 }
103118 }
104119 } } ) ) ;
@@ -137,27 +152,28 @@ var SideMenuView = /** @class */ (function (_super) {
137152 */
138153 SideMenuView . prototype . render = function ( ) {
139154 /** Props */
140- var _a = this . props , children = _a . children , left = _a . left , right = _a . right , sideMargin = _a . sideMargin , sideMarginLeft = _a . sideMarginLeft , sideMarginRight = _a . sideMarginRight , props = __rest ( _a , [ "children" , "left" , "right" , "sideMargin" , "sideMarginLeft" , "sideMarginRight" ] ) ;
155+ var _a = this . props , children = _a . children , direction = _a . direction , sideMargin = _a . sideMargin , sideMarginLeft = _a . sideMarginLeft , sideMarginRight = _a . sideMarginRight , props = __rest ( _a , [ "children" , "direction" , "sideMargin" , "sideMarginLeft" , "sideMarginRight" ] ) ;
156+ var directionIsLeft = direction ? direction == 'left' : true ;
141157 return ( React . createElement ( react_native_1 . View , __assign ( { } , props ) ,
142158 children ,
143- left ? ( React . createElement ( react_native_1 . View , __assign ( { style : {
159+ directionIsLeft ? ( React . createElement ( react_native_1 . View , __assign ( { style : {
144160 left : 0 ,
145161 position : 'absolute' ,
146162 width : sideMargin || sideMarginLeft ,
147163 height : screenHeight ,
148164 zIndex : 9999 ,
149- } } , this . _leftPanResponder . panHandlers ) ) ) : null ,
150- right ? ( React . createElement ( react_native_1 . View , __assign ( { style : {
165+ } } , this . _leftPanResponder . panHandlers ) ) ) : ( React . createElement ( react_native_1 . View , __assign ( { style : {
151166 position : 'absolute' ,
152167 right : 0 ,
153168 width : sideMargin || sideMarginRight ,
154169 height : screenHeight ,
155170 zIndex : 9999 ,
156- } } , this . _rightPanResponder . panHandlers ) ) ) : null ) ) ;
171+ } } , this . _rightPanResponder . panHandlers ) ) ) ) ) ;
157172 } ;
158173 SideMenuView . defaultProps = {
159174 sideMargin : 15 ,
160175 swipeSensitivity : 0.2 ,
176+ direction : 'left' ,
161177 } ;
162178 return SideMenuView ;
163179} ( React . Component ) ) ;
0 commit comments