react-native-international-phone-number 0.2.7 → 0.2.9

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.
package/README.md CHANGED
@@ -52,7 +52,7 @@ AND
52
52
  ## Features
53
53
 
54
54
  - 📱 Works with iOS, Android (Cross-platform) and Expo;
55
- - 🎨 Lib with UI customizable
55
+ - 🎨 Lib with UI customizable;
56
56
  - 🌎 Phone Input Mask according to the selected country.
57
57
 
58
58
  ## Basic Usage
@@ -204,6 +204,35 @@ export default function App() {
204
204
  }
205
205
  ```
206
206
 
207
+ ## Customizing lib
208
+
209
+ ### Dark mode:
210
+
211
+ ```jsx
212
+ <PhoneInput
213
+ ...
214
+ withDarkTheme
215
+ />
216
+ ```
217
+
218
+ ### containerStyle + inputStyle:
219
+
220
+ ```jsx
221
+ <PhoneInput
222
+ ...
223
+ inputStyle={{
224
+ color: '#F3F3F3',
225
+ }}
226
+ containerStyle={{
227
+ backgroundColor: '#575757',
228
+ borderWidth: 1,
229
+ borderStyle: 'solid',
230
+ borderColor: '#F3F3F3',
231
+ marginVertical: 16,
232
+ }}
233
+ />
234
+ ```
235
+
207
236
  ## Props
208
237
 
209
238
  - `value?`: string
package/lib/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
- import { StyleProp, TextInputProps, ViewStyle } from 'react-native';
2
+ import {
3
+ StyleProp,
4
+ TextInputProps,
5
+ TextStyle,
6
+ ViewStyle,
7
+ } from 'react-native';
3
8
  import { Country } from 'react-native-country-picker-modal';
4
9
 
5
10
  interface PhoneInputProps extends TextInputProps {
6
11
  placeholder?: string;
7
12
  placeholderTextColor?: string;
8
13
  containerStyle?: StyleProp<ViewStyle>;
9
- inputStyle?: StyleProp<ViewStyle>;
14
+ inputStyle?: StyleProp<TextStyle>;
10
15
  withDarkTheme?: boolean;
11
16
  disabled?: boolean;
12
17
  selectedCountry: undefined | Country;
package/lib/index.js CHANGED
@@ -16,6 +16,7 @@ import { phoneMask } from './utils/inputMask';
16
16
  function PhoneInput({
17
17
  placeholder,
18
18
  placeholderTextColor,
19
+ selectionColor,
19
20
  containerStyle,
20
21
  inputStyle,
21
22
  withDarkTheme,
@@ -46,7 +47,12 @@ function PhoneInput({
46
47
  }, []);
47
48
 
48
49
  return (
49
- <View style={containerStyle ? containerStyle : styles.container}>
50
+ <View
51
+ style={[
52
+ withDarkTheme ? styles.darkContainer : styles.lightContainer,
53
+ containerStyle ? containerStyle : {},
54
+ ]}
55
+ >
50
56
  <CountryPicker
51
57
  containerButtonStyle={{
52
58
  paddingLeft: 20,
@@ -58,12 +64,26 @@ function PhoneInput({
58
64
  countryCode={selectedCountry ? selectedCountry.cca2 : 'BR'}
59
65
  />
60
66
  <TextInput
61
- style={inputStyle ? inputStyle : styles.input}
67
+ style={[
68
+ withDarkTheme ? styles.darkInput : styles.lightInput,
69
+ inputStyle ? inputStyle : {},
70
+ ]}
62
71
  placeholder={
63
72
  placeholder ? placeholder : 'Insert your phone number'
64
73
  }
65
74
  placeholderTextColor={
66
- placeholderTextColor ? placeholderTextColor : '#DDDDDD'
75
+ placeholderTextColor
76
+ ? placeholderTextColor
77
+ : withDarkTheme
78
+ ? '#CCCCCC'
79
+ : '#DDDDDD'
80
+ }
81
+ selectionColor={
82
+ selectionColor
83
+ ? selectedColor
84
+ : withDarkTheme
85
+ ? '#F3F3F3'
86
+ : '#0A0A0A'
67
87
  }
68
88
  editable={!disabled}
69
89
  keyboardType="numeric"
@@ -73,22 +93,39 @@ function PhoneInput({
73
93
  );
74
94
  }
75
95
 
96
+ const containerBase = {
97
+ flexDirection: 'row',
98
+ alignItems: 'center',
99
+ borderWidth: 1,
100
+ borderStyle: 'solid',
101
+ borderRadius: 8,
102
+ };
103
+
104
+ const inputBase = {
105
+ width: Dimensions.get('window').width - 100,
106
+ paddingVertical: Platform.OS === 'ios' ? 16 : 8,
107
+ paddingHorizontal: 16,
108
+ fontSize: 16,
109
+ };
110
+
76
111
  const styles = StyleSheet.create({
77
- container: {
78
- flexDirection: 'row',
79
- alignItems: 'center',
112
+ lightContainer: {
113
+ ...containerBase,
80
114
  backgroundColor: '#FFFFFF',
81
- borderWidth: 1,
82
- borderStyle: 'solid',
83
- borderColor: '#DDDDDD',
84
- borderRadius: 8,
115
+ borderColor: '#AAAAAA',
116
+ },
117
+ darkContainer: {
118
+ ...containerBase,
119
+ backgroundColor: '#575757',
120
+ borderColor: '#F3F3F3',
121
+ },
122
+ lightInput: {
123
+ ...inputBase,
124
+ color: '#0A0A0A',
85
125
  },
86
- input: {
87
- width: Dimensions.get('window').width - 100,
88
- paddingVertical: Platform.OS === 'ios' ? 16 : 8,
89
- paddingHorizontal: 16,
90
- fontSize: 16,
91
- color: '#000000',
126
+ darkInput: {
127
+ ...inputBase,
128
+ color: '#F3F3F3',
92
129
  },
93
130
  });
94
131
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-international-phone-number",
3
3
  "author": "AstrOOnauta (https://github.com/AstrOOnauta)",
4
- "version": "0.2.7",
4
+ "version": "0.2.9",
5
5
  "description": "International mobile phone input component with mask for React Native",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",