Skip to content

Commit 93429af

Browse files
committed
refactor(inputs): make certain props optional and handle non-null assertions
Changed `type`, `size`, and `radius` in `BaseInputProps` from required to optional by using '?' modifier. Updated TypeScript code in `number-text-box` and `text-box` components to use non-null assertion operator for these properties where necessary. This change provides more flexibility when using the input components, allowing for default values to be applied if these attributes are not specified explicitly. Additionally, incremented package version from 0.0.9 to 0.0.10.
1 parent 8b7fa2a commit 93429af

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

npm-packages/src/packages/components/ra-inputs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flexnative/inputs",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"description": "React Native Inputs",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

npm-packages/src/packages/components/ra-inputs/src/input.props.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @ Author: Redon Alla
33
* @ Create Time: 2024-06-17 22:55:53
44
* @ Modified by: Redon Alla
5-
* @ Modified time: 2024-11-27 22:18:17
5+
* @ Modified time: 2025-02-01 23:50:28
66
* @ Description: Defines interfaces and types commonly used for input components, specifically tailored for a UI library or framework based on React Native. It provides a structured way to define the properties that these components will accept.
77
*/
88

@@ -38,19 +38,19 @@ export interface BaseInputProps extends TextInputProps {
3838
*
3939
* @default 'outlined'
4040
*/
41-
type: InputType;
41+
type?: InputType;
4242

4343
/**
4444
* Defines the size of the input field.
4545
* @default 'normal'
4646
*/
47-
size: Sizes;
47+
size?: Sizes;
4848

4949
/** Sets the border radius of the input
5050
*
5151
* @default 'medium'
5252
*/
53-
radius: BorderRadius;
53+
radius?: BorderRadius;
5454

5555
/**
5656
* Optional property to specify the width of the input borders.

npm-packages/src/packages/components/ra-inputs/src/number-text-box/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ export default class extends React.PureComponent<NumberTextBoxProps, State> {
157157

158158
const styles = createStyles(
159159
{
160-
type: type,
160+
type: type!,
161161
color: color!,
162-
size: size,
163-
radius: radius,
162+
size: size!,
163+
radius: radius!,
164164
borderWidth: borderWidth,
165165
disabled: disabled,
166166
readOnly: readOnly,
@@ -233,8 +233,8 @@ export default class extends React.PureComponent<NumberTextBoxProps, State> {
233233
isMaterial={material!}
234234
showActions={actions}
235235
disabled={Boolean(disabled || readOnly)}
236-
size={size}
237-
borderRadius={radius}
236+
size={size!}
237+
borderRadius={radius!}
238238
theme={this.context}
239239
onIncrement={this.handleIncrement}
240240
onDecrement={this.handleDecrement}

npm-packages/src/packages/components/ra-inputs/src/text-box.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ export default class TextBox extends React.PureComponent<BaseInputProps, State>
142142

143143
const styles = createStyles(
144144
{
145-
type: type,
145+
type: type!,
146146
color: color!,
147-
size: size,
148-
radius: radius,
147+
size: size!,
148+
radius: radius!,
149149
borderWidth: borderWidth,
150150
disabled: disabled,
151151
readOnly: readOnly,

0 commit comments

Comments
 (0)