@@ -14,6 +14,7 @@ import {
14
14
StyleSheet ,
15
15
ActivityIndicator ,
16
16
Keyboard ,
17
+ I18nManager ,
17
18
} from 'react-native' ;
18
19
19
20
const styles = StyleSheet . create ( {
@@ -35,7 +36,6 @@ const styles = StyleSheet.create({
35
36
transform : [ { translateY : - 10 } ] ,
36
37
} ,
37
38
rtlText : {
38
- textAlign : 'right' ,
39
39
writingDirection : 'rtl' ,
40
40
} ,
41
41
suggestionsContainer : {
@@ -61,9 +61,6 @@ const styles = StyleSheet.create({
61
61
marginTop : 2 ,
62
62
textAlign : 'left' ,
63
63
} ,
64
- leftAligned : {
65
- left : 15 ,
66
- } ,
67
64
rightAligned : {
68
65
right : 15 ,
69
66
} ,
@@ -143,7 +140,7 @@ const GooglePlacesTextInput = forwardRef(
143
140
const headers = {
144
141
'Content-Type' : 'application/json' ,
145
142
} ;
146
- if ( apiKey || apiKey != '' ) {
143
+ if ( apiKey || apiKey !== '' ) {
147
144
headers [ 'X-Goog-Api-Key' ] = apiKey ;
148
145
}
149
146
const response = await fetch ( API_URL , {
@@ -202,8 +199,7 @@ const GooglePlacesTextInput = forwardRef(
202
199
} ;
203
200
204
201
// Update text alignment based on language
205
- const isRTL =
206
- languageCode ?. startsWith ( 'he' ) || languageCode ?. startsWith ( 'ar' ) ;
202
+ const isRTL = I18nManager . isRTL ;
207
203
208
204
const renderSuggestion = ( { item } ) => {
209
205
const { mainText, secondaryText } = item . placePrediction . structuredFormat ;
@@ -276,14 +272,10 @@ const GooglePlacesTextInput = forwardRef(
276
272
onChangeText = { handleTextChange }
277
273
onFocus = { handleFocus }
278
274
onBlur = { ( ) => setShowSuggestions ( false ) }
279
- textAlign = { isRTL ? 'right' : 'left' }
280
275
/>
281
276
{ loading && showLoadingIndicator && (
282
277
< ActivityIndicator
283
- style = { [
284
- styles . loadingIndicator ,
285
- isRTL ? styles . leftAligned : styles . rightAligned ,
286
- ] }
278
+ style = { [ styles . loadingIndicator , styles . rightAligned ] }
287
279
size = { 'small' }
288
280
color = { style . loadingIndicator ?. color || '#000000' } // Default color
289
281
/>
0 commit comments