@bigbinary/neetoui-rn 0.0.64 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ParentView=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _propTypes=_interopRequireDefault(require("prop-types"));var _native=require("styled-components/native");var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ParentView=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _propTypes=_interopRequireDefault(require("prop-types"));var _native=require("styled-components/native");var _=require("./");var _excluded=["barStyle","children","backgroundColor","bg"];var _this=this,_jsxFileName="/Users/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/ParentView.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var ParentView=function ParentView(_ref){var _ref$barStyle=_ref.barStyle,barStyle=_ref$barStyle===void 0?"light-content":_ref$barStyle,children=_ref.children,backgroundColor=_ref.backgroundColor,bg=_ref.bg,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var theme=(0,_react.useContext)(_native.ThemeContext);var newBackgroundColor=backgroundColor||bg||theme.colors.background.parentView;var statusBarColors={default:theme.colors.background.white,"dark-content":theme.colors.background.white,"light-content":theme.colors.background.base};var statusBarColor=statusBarColors[barStyle]||statusBarColors["default"];return _react.default.createElement(_.Container,{flex:1,__self:_this,__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:5}},_react.default.createElement(_.Container,{backgroundColor:statusBarColor,__self:_this,__source:{fileName:_jsxFileName,lineNumber:49,columnNumber:7}},_react.default.createElement(_reactNative.SafeAreaView,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:50,columnNumber:9}},_react.default.createElement(_reactNative.StatusBar,{barStyle:barStyle,backgroundColor:statusBarColor,__self:_this,__source:{fileName:_jsxFileName,lineNumber:51,columnNumber:11}}))),_react.default.createElement(_.Container,(0,_extends2.default)({flex:1,backgroundColor:newBackgroundColor},rest,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:54,columnNumber:7}}),children));};exports.ParentView=ParentView;ParentView.propTypes={barStyle:_propTypes.default.string,children:_propTypes.default.node,backgroundColor:_propTypes.default.string,bg:_propTypes.default.string};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neetoui-rn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "BigBinary",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@styled-system/prop-types": "^5.1.5",
|
|
48
|
-
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
49
48
|
"react-native-modal": "^13.0.0",
|
|
50
49
|
"react-native-pell-rich-editor": "^1.8.6",
|
|
51
50
|
"react-native-remix-icon": "^0.3.0",
|
package/src/components/Input.js
CHANGED
|
@@ -63,11 +63,14 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
63
63
|
const {
|
|
64
64
|
label = "",
|
|
65
65
|
labelStyles,
|
|
66
|
+
containerStyles,
|
|
66
67
|
message = "",
|
|
67
68
|
error = false,
|
|
68
69
|
onFocus,
|
|
69
70
|
onBlur,
|
|
70
71
|
inline = false,
|
|
72
|
+
LeftIcon,
|
|
73
|
+
RightIcon,
|
|
71
74
|
brandRight,
|
|
72
75
|
brandLeft,
|
|
73
76
|
brandColor = "font.grey600",
|
|
@@ -75,6 +78,7 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
75
78
|
disabled = false,
|
|
76
79
|
secureTextEntry = false,
|
|
77
80
|
textAlignVertical = "top",
|
|
81
|
+
enableFocusStyle = false,
|
|
78
82
|
...rest
|
|
79
83
|
} = props;
|
|
80
84
|
|
|
@@ -95,38 +99,44 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
95
99
|
setIsFocus(false);
|
|
96
100
|
};
|
|
97
101
|
|
|
98
|
-
const focusStyles =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
const focusStyles = enableFocusStyle &&
|
|
103
|
+
isFocus && {
|
|
104
|
+
borderRadius: 4,
|
|
105
|
+
borderColor: error
|
|
106
|
+
? "rgba(255, 105, 105, 0.3)"
|
|
107
|
+
: theme.colors.border.grey400,
|
|
108
|
+
borderWidth: inline ? "0px" : "3px",
|
|
109
|
+
borderStyle: "solid",
|
|
110
|
+
};
|
|
106
111
|
|
|
107
112
|
const disabledStyles = disabled && {
|
|
108
113
|
opacity: 0.5,
|
|
109
114
|
bg: theme.colors.background.secondary,
|
|
110
115
|
};
|
|
111
116
|
|
|
112
|
-
const inlineInputStyles =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
const inlineInputStyles = enableFocusStyle &&
|
|
118
|
+
isFocus && {
|
|
119
|
+
backgroundColor: error
|
|
120
|
+
? theme.colors.border.danger
|
|
121
|
+
: theme.colors.border.base,
|
|
122
|
+
};
|
|
117
123
|
|
|
118
124
|
return (
|
|
119
125
|
<Container>
|
|
120
|
-
{!inline && (
|
|
126
|
+
{!inline && !!label && (
|
|
121
127
|
<LabelText labelStyles={labelStyles} inline={inline} label={label} />
|
|
122
128
|
)}
|
|
123
129
|
<Container
|
|
130
|
+
border={!inline}
|
|
131
|
+
borderColor={borderColor}
|
|
132
|
+
borderRadius={2}
|
|
124
133
|
{...focusStyles}
|
|
125
134
|
{...disabledStyles}
|
|
126
135
|
flexDirection={inline ? "row" : "column"}
|
|
127
136
|
onBlur={handleBlur}
|
|
128
137
|
onFocus={handleFocus}
|
|
129
138
|
position="relative"
|
|
139
|
+
{...containerStyles}
|
|
130
140
|
>
|
|
131
141
|
{inline && (
|
|
132
142
|
<Container alignSelf="flex-end" maxWidth={100}>
|
|
@@ -138,10 +148,14 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
138
148
|
</Container>
|
|
139
149
|
)}
|
|
140
150
|
<Container flexDirection="row" width="100%">
|
|
151
|
+
{LeftIcon && (
|
|
152
|
+
<Container alignSelf="center" mx="4px">
|
|
153
|
+
<LeftIcon />
|
|
154
|
+
</Container>
|
|
155
|
+
)}
|
|
141
156
|
{brandLeft && (
|
|
142
157
|
<InputText
|
|
143
158
|
text={brandLeft}
|
|
144
|
-
borderColor={borderColor}
|
|
145
159
|
brandColor={brandColor}
|
|
146
160
|
brandBackground={brandBackground}
|
|
147
161
|
/>
|
|
@@ -151,7 +165,6 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
151
165
|
height={40}
|
|
152
166
|
flex={1}
|
|
153
167
|
textStyle="subtext"
|
|
154
|
-
border={!inline && borderColor}
|
|
155
168
|
editable={!disabled}
|
|
156
169
|
color={error ? theme.colors.font.danger : theme.colors.font.primary}
|
|
157
170
|
secureTextEntry={secureTextEntry && !isPasswordVisible}
|
|
@@ -162,26 +175,27 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
162
175
|
{brandRight && (
|
|
163
176
|
<InputText
|
|
164
177
|
text={brandRight}
|
|
165
|
-
borderColor={borderColor}
|
|
166
178
|
brandColor={brandColor}
|
|
167
179
|
brandBackground={brandBackground}
|
|
168
180
|
/>
|
|
169
181
|
)}
|
|
182
|
+
|
|
183
|
+
{RightIcon && (
|
|
184
|
+
<Container alignSelf="center" mx="4px">
|
|
185
|
+
<RightIcon />
|
|
186
|
+
</Container>
|
|
187
|
+
)}
|
|
188
|
+
|
|
189
|
+
{secureTextEntry && (
|
|
190
|
+
<Container justifyContent="center" mx="4px">
|
|
191
|
+
<Icon
|
|
192
|
+
name={isPasswordVisible ? "eye-line" : "eye-off-line"}
|
|
193
|
+
color={theme.colors.background.grey500}
|
|
194
|
+
onPress={() => setIsPasswordVisible(!isPasswordVisible)}
|
|
195
|
+
/>
|
|
196
|
+
</Container>
|
|
197
|
+
)}
|
|
170
198
|
</Container>
|
|
171
|
-
{secureTextEntry && (
|
|
172
|
-
<Container
|
|
173
|
-
position="absolute"
|
|
174
|
-
left="90%"
|
|
175
|
-
height="100%"
|
|
176
|
-
justifyContent="center"
|
|
177
|
-
>
|
|
178
|
-
<Icon
|
|
179
|
-
name={isPasswordVisible ? "eye-line" : "eye-off-line"}
|
|
180
|
-
color={theme.colors.background.grey500}
|
|
181
|
-
onPress={() => setIsPasswordVisible(!isPasswordVisible)}
|
|
182
|
-
/>
|
|
183
|
-
</Container>
|
|
184
|
-
)}
|
|
185
199
|
</Container>
|
|
186
200
|
{inline && (
|
|
187
201
|
<View
|
|
@@ -195,14 +209,8 @@ export const Input = React.forwardRef((props, ref) => {
|
|
|
195
209
|
);
|
|
196
210
|
});
|
|
197
211
|
|
|
198
|
-
const InputText = ({ text,
|
|
199
|
-
<Container
|
|
200
|
-
bg={brandBackground}
|
|
201
|
-
justifyContent="center"
|
|
202
|
-
px={2}
|
|
203
|
-
borderColor={borderColor}
|
|
204
|
-
borderWidth="1px"
|
|
205
|
-
>
|
|
212
|
+
const InputText = ({ text, brandColor, brandBackground }) => (
|
|
213
|
+
<Container bg={brandBackground} justifyContent="center" px={2}>
|
|
206
214
|
{text && <Typography color={brandColor}>{text}</Typography>}
|
|
207
215
|
</Container>
|
|
208
216
|
);
|
|
@@ -239,9 +247,13 @@ Input.propTypes = {
|
|
|
239
247
|
*/
|
|
240
248
|
label: PropTypes.string,
|
|
241
249
|
/**
|
|
242
|
-
* To change the styles of label
|
|
250
|
+
* To change the styles of label.
|
|
243
251
|
*/
|
|
244
252
|
labelStyles: PropTypes.object,
|
|
253
|
+
/**
|
|
254
|
+
* To change the styles of input text container.
|
|
255
|
+
*/
|
|
256
|
+
containerStyles: PropTypes.object,
|
|
245
257
|
/**
|
|
246
258
|
* To display error/info messages
|
|
247
259
|
*/
|
|
@@ -251,15 +263,15 @@ Input.propTypes = {
|
|
|
251
263
|
*/
|
|
252
264
|
error: PropTypes.bool,
|
|
253
265
|
/**
|
|
254
|
-
* Changes input layout to inline
|
|
266
|
+
* Changes input layout to inline.
|
|
255
267
|
*/
|
|
256
268
|
inline: PropTypes.bool,
|
|
257
269
|
/**
|
|
258
|
-
* Display brand to the right of input
|
|
270
|
+
* Display brand to the right of input.
|
|
259
271
|
*/
|
|
260
272
|
brandRight: PropTypes.string,
|
|
261
273
|
/**
|
|
262
|
-
* Display brand to the left of input
|
|
274
|
+
* Display brand to the left of input.
|
|
263
275
|
*/
|
|
264
276
|
brandLeft: PropTypes.string,
|
|
265
277
|
/**
|
|
@@ -267,17 +279,29 @@ Input.propTypes = {
|
|
|
267
279
|
*/
|
|
268
280
|
disabled: PropTypes.bool,
|
|
269
281
|
/**
|
|
270
|
-
* To change the color of brand text
|
|
282
|
+
* To change the color of brand text.
|
|
271
283
|
*/
|
|
272
284
|
brandColor: PropTypes.string,
|
|
273
285
|
/**
|
|
274
|
-
* To change the color of brand text
|
|
286
|
+
* To change the color of brand text.
|
|
275
287
|
*/
|
|
276
288
|
brandBackground: PropTypes.string,
|
|
277
289
|
/**
|
|
278
|
-
* To hide and show password and enable secure text entry
|
|
290
|
+
* To hide and show password and enable secure text entry.
|
|
279
291
|
*/
|
|
280
292
|
secureTextEntry: PropTypes.bool,
|
|
293
|
+
/**
|
|
294
|
+
* If true, shows border on focus.
|
|
295
|
+
*/
|
|
296
|
+
enableFocusStyle: PropTypes.bool,
|
|
297
|
+
/**
|
|
298
|
+
* Display Icon to the left of input.
|
|
299
|
+
*/
|
|
300
|
+
LeftIcon: PropTypes.func,
|
|
301
|
+
/**
|
|
302
|
+
* Display Icon to the Right of input.
|
|
303
|
+
*/
|
|
304
|
+
RightIcon: PropTypes.func,
|
|
281
305
|
children: PropTypes.node,
|
|
282
306
|
};
|
|
283
307
|
|
|
@@ -301,9 +325,7 @@ ErrorMessage.propTypes = {
|
|
|
301
325
|
|
|
302
326
|
TextInput.defaultProps = {
|
|
303
327
|
height: 40,
|
|
304
|
-
border: 1,
|
|
305
328
|
px: 2,
|
|
306
329
|
fontFamily: "inter400",
|
|
307
330
|
fontSize: "14px",
|
|
308
|
-
borderRadius: 2,
|
|
309
331
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
import { SafeAreaView, StatusBar
|
|
2
|
+
import { SafeAreaView, StatusBar } from "react-native";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { ThemeContext } from "styled-components/native";
|
|
5
|
-
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
6
5
|
import { Container } from "@components";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
|
-
*ParentView wraps the childrens with SafeAreaview
|
|
8
|
+
*ParentView wraps the childrens with SafeAreaview.
|
|
10
9
|
*
|
|
11
10
|
* ## Usage
|
|
12
11
|
* ```js
|
|
@@ -46,21 +45,16 @@ export const ParentView = ({
|
|
|
46
45
|
statusBarColors[barStyle] || statusBarColors["default"];
|
|
47
46
|
|
|
48
47
|
return (
|
|
49
|
-
<
|
|
50
|
-
enableOnAndroid={true}
|
|
51
|
-
contentContainerStyle={styles.scrollView}
|
|
52
|
-
showsVerticalScrollIndicator={false}
|
|
53
|
-
style={{ backgroundColor: newBackgroundColor }}
|
|
54
|
-
>
|
|
48
|
+
<Container flex={1}>
|
|
55
49
|
<Container backgroundColor={statusBarColor}>
|
|
56
50
|
<SafeAreaView>
|
|
57
|
-
<StatusBar barStyle={barStyle} />
|
|
51
|
+
<StatusBar barStyle={barStyle} backgroundColor={statusBarColor} />
|
|
58
52
|
</SafeAreaView>
|
|
59
53
|
</Container>
|
|
60
54
|
<Container flex={1} backgroundColor={newBackgroundColor} {...rest}>
|
|
61
55
|
{children}
|
|
62
56
|
</Container>
|
|
63
|
-
</
|
|
57
|
+
</Container>
|
|
64
58
|
);
|
|
65
59
|
};
|
|
66
60
|
|
|
@@ -79,9 +73,3 @@ ParentView.propTypes = {
|
|
|
79
73
|
*/
|
|
80
74
|
bg: PropTypes.string,
|
|
81
75
|
};
|
|
82
|
-
|
|
83
|
-
const styles = StyleSheet.create({
|
|
84
|
-
scrollView: {
|
|
85
|
-
flexGrow: 1,
|
|
86
|
-
},
|
|
87
|
-
});
|